next up previous contents index
Next: Setting up NIS Clients Up: NFS/NIS Servers Previous: Mounting Directories   Contents   Index


Setting up a NIS Master Server

In this section we will setup an NIS server on a machine named nis.bob.org in our network. NIS servers are nice because they allow many machines on a network to share passwords and other information. This is very nice in a lab setting where users of the lab may want to log into different machines without needing to remember multiple passwords.

In order to setup and run an NIS server you need to have portmap running. Since portmap is on by default you should not have to do anything, but just incase it is off you should check it. You can test this by running this command:

bash# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting

If you get something other than the above response then you will need to start portmap.

Once you have portmap running you will need to decide a domainname for the NIS information to be sent on. Let's pick the name bob.org for our domainname. Set the domainname with the ypdomainname command like this:

bash# ypdomainname bob.org

Now let's initialize the master server. For this example we will not have any secondary servers:

bash# /usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers.  nis.bob.org 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:  nis.bob.org
	next host to add:  
The current list of NIS servers looks like this:

nis.bob.org

Is this correct?  [y/n: y]  
We need some  minutes to build the databases...
Building /var/yp/bob.org/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/bob.org'
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/bob.org'

At the prompt we want to just press Ctrl-d and then confirm the list. As you can see there were multiple files worked with. Most of the important stuff happens in the /var/yp/ directory. Now start the ypserv server:

bash# /etc/rc.d/init.d/ypserv start

If you ever change passwords or create new accounts then you will need to make sure the new data gets loaded into the NIS servers. You can do this by typing the following lines:

bash# cd /var/yp/
bash# make

That should take care of your NIS server. Now for the client.


next up previous contents index
Next: Setting up NIS Clients Up: NFS/NIS Servers Previous: Mounting Directories   Contents   Index
Joseph Colton 2002-09-24