Network Information Service (NIS)

From LQWiki
Jump to: navigation, search

The NIS (Network Information Service) also known as YP (Yellow Pages) is a client-server directory service protocol for distributing system configuration. NIS/YP is used for keeping a central directory of user names and passwords, hostnames and their IP addresses, and most other useful things in a computer network.

Configuring a NIS/YP client

In order to setup a machine to be a NIS/YP client, your system must have the following programs:

RPM based systems can easily get these programs by installing the portmap, ypbind, and yp-tools packages. Next, make sure that your /etc/nsswitch.conf is set to

   :passwd:     files nis nisplus
   :shadow:     files nis nisplus
   :group:      files nis nisplus

This allows the system to first try the local files (i.e. /etc/hosts, /etc/passwd) before using the the NIS (or the NIS+) service. This means that if a particular user has a local account on machine A, then this user can log into machine A, but not machine B or C. However, if this user has an entry on the NIS server, then machines B and C will allow this user to login as well. Conversely, if a different user tries to log into machine A and that user also has an entry on the NIS server, then that user will be able to login also.

Next, modify the /etc/yp.conf file to specify the domain and the NIS server name:

  :domain server MyNISServer 

and the /etc/hosts file to define the IP address of the NIS server:

  :    MyNISServer 

Lastly, edit your /etc/rc.d/rc.sysinit to add: 

Make sure that your portmap and ypbind services startup at boot time, and reboot your system. Now, you should be able to type commands like:

  :$ypcat hosts
  :$ypcat passwd

to see all NIS defined hostnames and users.

See also