Operating System - HP-UX
1834544 Members
3395 Online
110069 Solutions
New Discussion

Re: script create NIS user

 
tom quach_1
Super Advisor

script create NIS user

Hello,

Does anyone know of any scripts to create NIS users, set default password and push to a second node.

Regards,
Tom
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: script create NIS user

You've really got to define the problem much better. What file actually serves as the source for the passwd map? Moreover, it's very common to have automount directories (especially for the users' home directories) stored by NIS. Normally, you run your script on the NIS master and remsh or ssh to cereate the home directory on the desired target machine and then do a ypmake. Ypmake will then do all the automatic pushing of the updated maps for you.

You will find that when you define the problem well enough, the script almost writes itself. Perl has the crypt() function which can be used to generate the passwd hash.
If it ain't broke, I can fix that.
tom quach_1
Super Advisor

Re: script create NIS user

Thank-you A.Clay

I am using NIS with home dir is an NFS folder, and have been creating users using SAM. Just would like to automate the process so i could do thing faster.
i am not sure "useradd" would work with NIS
but will try it out.

Thanks,
Tom
Peter Nikitka
Honored Contributor

Re: script create NIS user

Hi,

when you use the /etc/passwd of the NIS master as source of the NIS map 'passwd', the 'useradd' on the NIS master will do it for all NIS users.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
tom quach_1
Super Advisor

Re: script create NIS user

thanks Peter,

i just create user using useradd and run ypmake
to generate the map and push it to other server.

thanks,
Tom
tom quach_1
Super Advisor

Re: script create NIS user

Thank you all for your help.

Regards,
Tom