Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Using NISisms in Your /etc/passwd File

The most popular use of NIS is to keep a global user database so that it is possible to grant access to any machine at your site to any user. Under Red Hat Linux, this behavior is implicit for all NIS clients.

Sometimes, however, you do not want everyone accessing certain systems, such as those used by personnel. You can fix this access by using the special token + in your /etc/passwd file. By default, NIS clients have the line +:::::: at the end of their /etc/passwd file, thereby allowing everyone in NIS to log in to the system. To arrange that the host remains a NIS client but does not grant everyone permission, change the line to read +::::::/bin/false. This will allow only people with actual entries in the /etc/passwd file for that host (for example, root) to log in.

To allow a specific person to log in to a host, you can add a line to the /etc/passwd file granting this access. The format of the line is + username :::::: where username is the login of the user you want to grant access to. NIS will automatically grab the user's passwd entry from the NIS server and use the correct information for determining the user information (for example, UID, GID, GECOS, and so on). You can override particular fields by inserting the new value in the + username :::::: entry. For example, if the user sshah uses /usr/local/bin/tcsh as his shell but the host he needs to log in to keeps it in /bin/tcsh, you can set his /etc/passwd entry to +sshah::::::/bin/tcsh.

Share ThisShare This

Informit Network