Network Information Services (NIS) Setup


NIS allows users to login from any of several networked computers and access the same user account. The necessary steps to set up NIS are:

  1. Choose one machine to be your NIS Server
  2. Configure the NIS Server on that machine
  3. Configure every other machine in the network to be a client of that NIS Server

So you've decided to choose an NIS Server

We chose to use my SPARC machine as our NIS Server so that it would not feel left out in our computational cluster. We wanted to keep the cluster homogeneous, and since we had four PCs and one SPARC, the one kid who was doing his own thing got chosen. It didn't have to be this way, though. The eeny-miney-moe method would have worked just as well.


Configuring the NIS Server

To configure the NIS Server, take the following steps on the chosen machine:

  1. Install the RPM packages associated with the following utilities:

    portmap
    yp-tools
    ypserv
    ypbind

  2. Choose a name for the NIS domain (I just used the hostname of my computer: unisys01)
  3. Modify NISDOMAIN entry in /etc/sysconfig/network to say:

    NISDOMAIN=(name you chose for NIS domain)

  4. Initialize server by running:

    /usr/lib/yp/ypinit -m

  5. In /var/yp/Makefile change the "all" entry (this entry determines which information to share with all the NIS clients) so that passwd and group are the only two not commented out (in other words, make sure the line at least says):

    all: passwd group

  6. Start the NIS services by typing:

    /etc/rc.d/init.d/portmap start
    /etc/rc.d/init.d/ypserv start
    /etc/rc.d/init.d/yppasswdd start
    /etc/rc.d/init.d/ypbind start

  7. Check to make sure the NIS services are running by typing:

    /usr/sbin/rpcinfo -p | grep yp

    You should see entries for each of the services you just started
  8. Anytime you update the passwd, shadow, or group files, you must update the NIS maps by typing:

    cd /var/yp
    make

    This is very important to remember! I always forget, and it always confuses the heck out of me why things aren't working right.
  9. Make sure NIS services will start up at run time. Run ntsysv and check in portmap, ypserv, yppasswdd, and ypbind.

Configuring the NIS Client

The following procedure must be performed on each NIS client:

  1. Install the RPM packages for the following utilities:

    yp-tools
    ypbind

  2. Verify the server allows you access to its remote procedure call (RPC) services by running:

    /usr/sbin/rpcinfo -p (server_name)

  3. Modify NISDOMAIN entry in /etc/sysconfig/network to the following:

    NISDOMAIN=(domain name that was chosen during server setup)

  4. Modify /etc/yp.conf to include the line:

    domain (domain-name) server (server-name)

    Make sure the server name is listed in your /etc/hosts file
  5. Remove any entries from your /etc/passwd, /etc/shadow, and /etc/group files that you wish to be queried from the NIS server
  6. Modify /etc/nsswitch.conf so the following entries look like the following:

    passwd: files nis
    shadow: files nis
    group: files nis
    hosts: files dns

  7. Start the NIS client by typing the following:

    /etc/rc.d/inint.d/ypbind start

  8. Make sure this service will start up at run time by typing ntsysv and checking in ypbind