How can I add a user to multiple DiRT machines at once? (NIS version)

Synopsis

  1. create a home directory on felix with appropriate ownership
  2. create an account on brutus, with a silly password and a homedir in /net/felix/dirt/
  3. append the new line in /etc/master.passwd (and /etc/passwd) to /var/yp/master.passwd (and /var/yp/passwd)
  4. update the NIS database
  5. clean up

1. Create homedir on felix

felix hosts all the home directories on the production network in the /dirt directory. You will need sudo access (ask the department) to create a directory here. Copy over the hidden files from /etc/skel, and be sure to chown -R username:groupname /dirt/username/.

2. Create account on brutus

From a departmental machine (felix, quartet, etc.), execute ypcat passwd | grep <username>, where <username> is the name of the user you want to add to tyagi. Copy the output. As root on brutus, execute vipw, and paste the information to the end. (This is necessary so that the UIDs sync up, so that there won't be any problems e.g. in directory ownership.) Change the shell to the user's liking (especially if it would otherwise be yukky old csh!). Save and quit, then type passwd <user> to give the user some throwaway password that you know.

3. Update /var/yp/master.passwd

At this point, /etc/master.passwd will have a new line in it for the new user, with the encrypted new password. Copy this line to /var/yp/master.passwd, which is the NIS version of the master.passwd file (without system accounts such as root). Copy the same line to the end of /var/yp/passwd.

4. Update the NIS database

The NIS maps stored in /var/yp/dirt-cs/ must be updated to use the new information in /var/yp/master.passwd and /var/yp/passwd. To do this update, cd to /var/yp and execute make. This should update the maps and push the updated maps out to professor, the NIS slave server. Check the output of make. If it fails, saying "master's version not newer", then either sync the dates on brutus and professor, or else wait a couple minutes and try again. (You can also run /usr/libexec/ypxfr manually on professor, but that's a little trickier.)

5. Clean up

Execute vipw on brutus and remove the new user account from the /etc/master.passwd and /etc/passwd files. The account information is already in the NIS database, and we don't want it in two places.


Jeff Terrell 09/14/05 - last updated 06/23/08 (jsterrel - minor corrections)