Solaris Naming Administration Guide

Adding a New User to an NIS Domain

To add a new NIS user:

  1. Log in as root on the master NIS server.

  2. Create the new user's login ID with the useradd command.

    For Solaris Release 2 systems, type the following:


    # useradd userID
    

    Where userID is the login ID of the new user. This command creates entries in the /etc/passwd and /etc/shadow files on the master NIS server.

  3. Create the new user's initial password.

    To create an initial password that the new user can use to log in, run the passwd command in the form:


    # passwd userID
    

    Where userID is the login ID of the new user. You will be prompted for the password to assign to this user.

    This step is necessary because the password entry created by the useradd command is locked, which means that the new user cannot log in. By specifying an initial password, you unlock the entry.

  4. If necessary, copy the new entry into the server's passwd map input files.

    If the map source files on your master server are in a directory other than /etc (as they should be), you have to copy and paste the new lines from the /etc/passwd and /etc/shadow files into the passwd map input files on the server. (See "Password Files and Namespace Security" for additional information on this matter.)

    For example, if you added the new user baruch, the line from /etc/passwd that you would copy to your passwd input file would look like:


    baruch:x:123:10:User baruch:/home/baruch:/bin/csh:

    The line for baruch that you would copy from /etc/shadow would look like:


    baruch:W12345GkHic:6445::::::

    Note -

    If you are using a Solaris Release 1 passwd file format as input for your NIS maps, you must use a text editor to add the new user to your passwd file, manually.


  5. Make sure that the Makefile correctly specifies the directory where the password input file resides.

  6. If appropriate, delete the new user's entries from /etc/passwd and /etc/shadow input files.

    For security reasons, it is not good practice to maintain user entries in the NIS master server /etc/passwd and /etc/shadow files. After copying the entries for the new user to the NIS map source files that are stored in some other directory, use the userdel command on the master server to delete the new user.

    For example, to delete the new user baruch from the master server's /etc files, you would enter:


    # userdel baruch

    For more information about userdel, see the userdel man page.

  7. Update the NIS passwd maps.

    After you have updated the passwd input file on the master server, update the passwd maps by running make in the directory containing the source file.


    # userdel baruch
    # cd /var/yp
    # /usr/ccs/bin/make passwd
  8. Tell the new user the initial password you have assigned to his or her login ID.

    After logging in, the new user can run passwd at any time to establish a different password.