- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Configuring a Master NIS Server
Before you configure the server software, you need to decide whether you are going to set up any slave servers. If you are, you need to know their hostnames before continuing. Along with the names of your NIS servers, you need to decide on a NIS domain name at this point. Remember that this domain name is not the same as your DNS domain name and for clarity should be set differently. Also, the names must be in the /etc/hosts file.
With this information, you are ready to begin. First, you need to set the domain name with the domainname command:
[root@vestax /etc]# domainname audionet.domain.com
Although this will work for the moment, you do need to change a startup configuration file so that this happens every time your system reboots. The /etc/init.d/ypserv script that was installed as part of the RPM looks for the domain name to be set in the /etc/sysconfig/network file. Simply add the following line:
NISDOMAIN="audionet.domain.com"
With the domain name set, you can decide what files you want to share via NIS, as well as their filenames. You do this by editing /var/yp/Makefile. As the name implies, NIS maintains its maps by using the make utility. Although familiarity with how this tool works is useful, it isn't mandatory in order to configure NIS.
Begin by loading /var/yp/Makefile into your favorite editor. Scroll past the lines that read as follows:
# These are files from which the NIS databases are built. You may edit # these to taste in the event that you wish to keep your NIS source files # separate from your NIS server's actual configuration files.
Below this segment of text, you will see lines that resemble the following:
GROUP = $(YPPWDDIR)/group PASSWD = $(YPPWDDIR)/passwd etc...
This section tells NIS where your database files are located. The $(YPPWDDIR) string is a variable that was set to /etc at the top of the Makefile. Although it is possible to change this to another directory, you should probably keep it there for consistency. The string that comes after $(YPPWDDIR) is the name of the file in /etc that will become shared through NIS. Most of these entries can remain the same. The few that you 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 can 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.
Your cursor should be at the following line:
all: passwd group hosts rpc services netid protocols mail # netgrp shadow publickey networks ethers bootparams printcap # amd.home auto.master auto.home auto.local passwd.adjunct # timezone locale netmasks
This line specifies which maps will be made available via NIS. The # symbol before netgrp is the comment symbol. The second and third lines are commented out.
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 group hosts rpc services netid protocols mail # netgrp shadow publickey networks ethers bootparams printcap # amd.home auto.master auto.home auto.local passwd.adjunct # timezone locale netmasks all: passwd group hosts rpc services netid protocols mail # netgrp shadow publickey networks ethers bootparams printcap # amd.home auto.master auto.home auto.local passwd.adjunct # timezone locale netmasks
By commenting out the line, you can retain a copy of it just in case something goes wrong. You can always refer to the copy and see how the line 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 passwd, group, hosts, rpc, services, netid, protocols, and mail. This distribution is already set, so you don't need to change anything.
Unless you are comfortable with makefiles, you should leave the remainder of the file alone. Save the makefile and quit the editor. You'll need to make sure that the ypserv daemon is running before proceeding any further. To ensure that it is running, execute the following:
/etc/init.d/ypserv start
You are ready to initialize your NIS database with the /usr/lib/yp/ypinit -m command. When invoked, this command prompts 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 you need to distribute the load they generate.
If you have not already set your domain name, the following initialization will error out with a message that says, "The local host's domain name hasn't been set. Please set it.". 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 Tuesday July 25 22:35:21 PDT 2000
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...
gmake[1]: Leaving directory '/var/yp/audionet.domain.com'
NIS Map update completed
If anywhere in the middle of the output, you receive 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. Check that you edited the makefile as you intended, and then 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 simply rerun cd /var/yp;make.
The hosts that you add are put into the file /var/yp/ypservers. As an alternative to running the ypinit command, you can manually edit the /var/yp/ypservers file and then run make using the preceding sequence.
Starting the Daemons on Boot
To start the NIS server automatically at boot time, you need to create a symbolic link from the runlevel 3 startup directory. To do this, type the following:
[root@client /root]# cd /etc/rc3.d [root@client rc3.d]# ln -s ../init.d/ypserv S60ypserv
The yppasswdd daemon allows users from NIS clients to change their passwords on the NIS server. To start this program automatically at boot time, you need to type the following:
[root@client /root]# cd /etc/rc3.d [root@client rc3.d]# ln -s ../init.d/yppasswdd S61yppasswdd
If you want to start the daemons by hand so you don't need to reboot, simply run the following:
[root@client /root]# /etc/init.d/ypserv start [root@client /root]# /etc/init.d/yppasswdd start
You now have a NIS master server. Time to test the work with a NIS client.
Configuring a NIS Client | Next Section

Account Sign In
View your cart