-->

Previous | Table of Contents | Next

Page 272

Most of these entries can remain the same. The few that you will want to change are GROUP, PASSWD, SHADOW, ALIASES, and possibly HOSTS.

The GROUP line shows that the file for controlling group information is at /etc/group. You might want to keep your local group file on the server separate from your NIS group file because your local group file could contain server-specific groups that you don't want to share across NIS, such as the www group for your Web server.

The same holds true for the other lines as well, especially the PASSWD line. A simple convention you might want to use to indicate that the file is being shared across NIS is to suffix it with a .yp. The resulting line looks something like the following:


PASSWD        = $(YPPWDDIR)/passwd.yp

With the filenames you want set, you can now determine which files to distribute. Scroll down the Makefile past the following block:


# If you don't want some of these maps built, feel free to comment

# them out of this list.

# Note that we don't build the eithers or bootparams maps by default

# since /etc/ethers and /etc/bootparams are not likely to be present

# on all systems

#

Your cursor should be at the following line:


all: passwd hosts group netid networks protocols rpc services netgrp

Âmail shadow ypservers publickey ethers # amd.home bootparams

This line specifies which maps will be made available via NIS. The # symbol after ethers is the comment symbol. The amd.home and bootparams maps are commented out at the moment.

Before making any changes to this line, you should make a copy of it and comment the copy out. The result looks something like the following:


#all: passwd hosts group netid networks protocols rpc services netgrp

#mail shadow ypservers publickey ethers # amd.home bootparams



all: passwd hosts group netid networks protocols rpc services netgrp

Âmail shadow ypservers publickey ethers # amd.home bootparams

By commenting out the line, you can retain a copy of it just in case something goes wrong. You can always look back to it and see how it looked before things were changed. With the copy in place, go ahead and begin your changes.

The only files you need to distribute for your network are the passwd, hosts, group, netid, protocols, rpc, services, mail, and ypservers. To indicate this change, edit the uncommented version of the line to read:


all: passwd hosts group netid protocols rpc services mail ypservers

Unless you are comfortable with Makefiles, you should leave the remainder of the file alone. Save the Makefile and quit the editor.

Page 273

You are now ready to initialize your NIS database. This is done with the /usr/lib/yp/ypinit command. When invoked, it will prompt for the name of any NIS slave servers you want to set up. For this example, select denon to be the slave NIS server.

Remember that you do not have to set up a slave NIS server. Setting up a slave server is only useful if you have a large number of NIS clients and need to distribute the load they generate.

To initialize the master server, use the following:


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

At this point, we have to construct a list of the hosts which will run NIS

servers. vestax 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:  vestax

    next host to add:  denon

    next host to add: <CTRL-D>

The current list of NIS servers looks like this:



vestax

denon



Is this correct?  [y/n: y]  y

We need some minutes to build the databases...

Building /var/yp/audionet.domain.com/ypservers...

Running /var/yp/Makefile...

NIS Map update started on Mon May  5 22:16:53 PDT 1997

make[1]: Entering directory `/var/yp/audionet.domain.com'

Updating passwd.byname...

Updating passwd.byuid...

Updating hosts.byname...

Updating hosts.byaddy...

Updating group.byname...

Updating group.bygid...

Updating netid.byname...

Updating protocols.bynumber...

Updating protocols.byname...

Updating rpc.byname...

Updating rpc.bynumber...

Updating services.byname...

Updating mail.aliases...

make[1]: Leaving directory `/var/yp/audionet.domain.com'

NIS Map update completed

If anywhere in the middle of the output you received a message like the following instead


make[1]:***No rule to make target `/etc/shadow', needed by `shadow.byname'. Stop.

make[1]: Leaving directory `/var/yp/audionet.domain.com'

it means that you are missing one of the files you listed in the Makefile. Go back and check that you edited the Makefile as you intended and then check to make sure that the files you selected to be shared via NIS actually do exist. After you've made sure of these, you do not need to rerun ypinit but instead can just rerun cd /var/yp;make.

Congratulations! You now have an NIS master server! Time to test the work with an NIS client.

Page 274

Configuring an NIS client

Compared to configuring an NIS server, NIS clients are trivial. There are only four files you need to deal with, one of which is only one line long.

Begin by creating the /etc/yp.conf file. This file needs only two lines, one to specify the NIS domain name and the other to specify the NIS server hostname. The format of this file is


domainname domainname

ypserver nis_server

where domainname is the name of your NIS domain and nis_server is the server's hostname. For this example, this file should look like the following:


domainname audionet.domain.com

ypserver vestax.domain.com

The next step is to modify the startup scripts so that your domainname gets set every time you boot. To do this, edit the /etc/rc.d/rc.local script and add the following lines to it:


#

# Setup NIS domain name

#

if [ -f /etc/domainname ]; then

    domainname `cat /etc/domainname'

    echo "NIS domain: `domainname'"

fi

This modification checks for the file /etc/domainname. If /etc/domainname is found, the NIS domain is set to the contents of that file.

In order to get the modification to /etc/rc.d/init.d/rc.local to be useful, you need to create the /etc/domainname file. The content of the file should be only the NIS domain name on the first line with no subsequent lines. For the sample network, this looks like the following:


audionet.domain.com

The last file that needs to be changed is the /etc/nsswitch.conf file. This is slightly more involved than the previous files; however, a default file comes as part of the Red Hat installation. This file is used to configure which services are to be used to determine information such as hostnames, password files, and group files.

Begin by opening /etc/nsswitch.conf with your favorite editor. Scroll down past the comments (those lines beginning with the # symbol). You should see something like this:


passwd:    files nis

shadow:    files nis

group:    files nis



hosts:    files nis dns



services:     files [NOTFOUND=return] nis

etc...

Previous | Table of Contents | Next