Go to main content

Working With Oracle® Solaris 11.3 Directory and Naming Services: DNS and NIS

Exit Print View

Updated: October 2017
 
 

How to Add a New NIS User to an NIS Domain

  1. Become an administrator on the NIS master server.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.3.

  2. Create the new user's login ID with the useradd command.
    # 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.

    # 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. Copy the new entry into the master server's passwd map input files.

    The map source files on your master server should be in a directory other than /etc. 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.

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

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

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

    brown:$5$YiFpYWXb$6jJkG/gKdfkKtlTbemORnbeH.qsvO9MwBD3ulTihq9B:6445::::::
  5. Make sure that the Makefile correctly specifies the directory where the password input file resides.
  6. Delete the new user's entries from the/etc/passwd and /etc/shadow input files.

    For security reasons, do not keep 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 brown from the master server's /etc files, you would enter the following.

    # userdel brown

    For more information about userdel, see the userdel(1M) 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 brown
    # cd /var/yp
    # 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.