Configuring the NIS Server



Configuring the NIS Server

NFS only covers file sharing over the network. You now have to configure NIS login authentication for the lab students before the job is done. The configuration of the NIS server is not difficult, but requires many steps that you may overlook. Don't worry, we'll review each one in detail.

Note

In the early days, NIS was called Yellow Pages. The developers had to change the name after a copyright infringement lawsuit, yet many of the key programs associated with NIS have kept their original names beginning with yp.


Edit Your /etc/sysconfig/network File

You need to add the NIS domain you wish to use in the /etc/sysconfig/network file. For the school, call the domain NIS-SCHOOL-NETWORK:

    #/etc/sysconfig/network
    NISDOMAIN="NIS-SCHOOL-NETWORK"

Edit Your /etc/yp.conf File

NIS servers also have to be NIS clients themselves, so you'll have to edit the NIS client configuration file /etc/yp.conf to list the domain's NIS server as being the server itself or localhost:

     # /etc/yp.conf - ypbind configuration file
     ypserver 127.0.0.1

Start the Key NIS Server-Related Daemons

Start the necessary NIS daemons in the /etc/init.d directory and use the chkconfig command to ensure they start after the next reboot.

[root@bigboy tmp]# service portmap start
Starting portmapper: [  OK  ]
[root@bigboy tmp]# service yppasswdd start
Starting YP passwd service: [  OK  ]
[root@bigboy tmp]# service ypserv start
Setting NIS domain name NIS-SCHOOL-NETWORK: [  OK  ]
Starting YP server services: [  OK  ]
[root@bigboy tmp]#

[root@bigboy tmp]# chkconfig portmap on
[root@bigboy tmp]# chkconfig yppasswdd on
[root@bigboy tmp]# chkconfig ypserv on
[root@bigboy tmp]#

Figure lists a summary of the daemon's functions.

Required NIS Server Daemons

Daemon Name

Purpose

portmap

The foundation RPC daemon upon which NIS runs

yppasswdd

Lets users change their passwords on the NIS server from NIS clients

ypserv

Main NIS server daemon

ypbind

Main NIS client daemon

ypxfrd

Used to speed up the transfer of very large NIS maps


Make sure they are all running before continuing to the next step. You can use the rpcinfo command to do this:

[root@bigboy tmp]# rpcinfo -p localhost
   program vers proto port
    100000    2   tcp  111    portmapper
    100000    2   udp  111    portmapper
    100009    1   udp  681    yppasswdd
    100004    2   udp  698    ypserv
    100004    1   udp  698    ypserv
    100004    2   tcp  701    ypserv
    100004    1   tcp  701    ypserv
[root@bigboy tmp]#

The ypbind and ypxfrd daemons won't start properly until after you initialize the NIS domain. You'll start these daemons after initialization is completed.

Initialize Your NIS Domain

Now that you have decided on the name of the NIS domain, you'll have to use the ypinit command to create the associated authentication files for the domain. You will be prompted for the name of the NIS server, which in this case is Bigboy.

With this procedure, all nonprivileged accounts are automatically accessible via NIS:

[root@bigboy tmp]# /usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run
NIS servers.  bigboy is in the list of NIS server hosts. Please
continue to add the names for the other hosts, one per line. When you
are done with the list, type a <control D>.
        next host to add: bigboy
        next host to add:
The current list of NIS servers looks like this:

bigboy

Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/NIS-SCHOOL-NETWORK/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/NIS-SCHOOL-NETWORK'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/NIS-SCHOOL-NETWORK'

bigboy has been set up as a NIS master server.

Now you can run ypinit -s bigboy on all slave server.
 [root@bigboy tmp]#

Note

Make sure portmap is running before trying this step or you'll get errors, such as:

          failed to send 'clear' to local ypserv: RPC: Port mapper
          failureUpdating group.bygid...


You will have to delete the /var/yp/NIS-SCHOOL-NETWORK directory and restart portmap, yppasswd, and ypserv before you'll be able to do this again successfully.

Start the ypbind and ypxfrd Daemons

You can now start the ypbind and the ypxfrd daemons because the NIS domain files have been created:

     [root@bigboy tmp]# service ypbind start
     Binding to the NIS domain: [  OK  ]
     Listening for an NIS domain server.
     [root@bigboy tmp]# service ypxfrd start
     Starting YP map server: [  OK  ]
     [root@bigboy tmp]# chkconfig ypbind on
     [root@bigboy tmp]# chkconfig ypxfrd on

Make Sure the Daemons Are Running

All the NIS daemons use RPC port mapping and, therefore, are listed using the rpcinfo command when they are running correctly.

    [root@bigboy tmp]# rpcinfo -p localhost
        program vers proto port
        100000     2   tcp   111   portmapper
        100000     2   udp   111   portmapper
        100003     2   udp  2049   nfs
        100003     3   udp  2049   nfs
        100021     1   udp  1024   nlockmgr
        100021     3   udp  1024   nlockmgr
        100021     4   udp  1024   nlockmgr
        100004     2   udp   784   ypserv
        100004     1   udp   784   ypserv
        100004     2   tcp   787   ypserv
        100004     1   tcp   787   ypserv
        100009     1   udp   798   yppasswdd
     600100069     1   udp   850   fypxfrd
     600100069     1   tcp   852   fypxfrd
        100007     2   udp   924   ypbind
        100007     1   udp   924   ypbind
        100007     2   tcp   927   ypbind
        100007     1   tcp   927   ypbind
   [root@bigboy  tmp]#