Adding New NIS Users



Adding New NIS Users

New NIS users can be created by logging into the NIS server and creating the new user account. In this case, you'll create a user account called nisuser and give it a new password.

Once this is complete, you then have to update the NIS domain's authentication files by executing the make command in the /var/yp directory.

This procedure makes all NIS-enabled, nonprivileged accounts become automatically accessible via NIS, not just newly created ones. It also exports all the user's characteristics stored in the /etc/passwd and /etc/group files, such as the login shell, the user's group, and home directory:

     [root@bigboy tmp]# useradd -g users nisuser
     [root@bigboy tmp]# passwd nisuser
     Changing password for user nisuser.
     New password:
     Retype new password:
     passwd: all authentication tokens updated successfully.
     [root@bigboy tmp]# cd /var/yp
     [root@bigboy yp]# make
     gmake[1]: Entering directory `/var/yp/NIS-SCHOOL-NETWORK'
     Updating passwd.byname...
     Updating passwd.byuid...
     Updating netid.byname...
     gmake[1]: Leaving directory `/var/yp/NIS-SCHOOL-NETWORK'
     [root@bigboy yp]#

You can check to see if the user's authentication information has been updated by using the ypmatch command, which should return the user's encrypted password string:

     [root@bigboy yp]# ypmatch nisuser passwd
     nisuser:$1$d6E2i79Q$wp3Eo0Qw9nFD/::504:100::/home/nisuser:/bin/bash
     [root@bigboy yp]

You can also use the getent command, which has similar syntax. Unlike ypmatch, getent doesn't provide an encrypted password when run on an NIS server, it just provides the user's entry in the /etc/passwd file. On a NIS client, the results are identical with both showing the encrypted password.

     [root@bigboy yp]# getent passwd nisuser
     nisuser:x:504:100::/home/nisuser:/bin/bash
     [root@bigboy yp]#