Setting Up Fedora or RHEL as an NIS Client


If your network uses NIS centrally to administer users, groups, network addresses, and other information, you can set up your Fedora or RHEL system to use that information as an NIS client. To configure Fedora or RHEL as an NIS client, you need to get the following information from your NIS administrator:

  • NIS Domain Name - This is a keyword used to describe the group of hosts that use the common set of NIS files. Domain name is an unfortunate way of referring to this keyword, because it doesn't have anything to do with the TCP/IP domain name. Its only similarity is that it refers to a group of computers.

  • NIS Master Server Name - This is the name of the computer on your network that maintains the NIS databases and responds to requests from the network for that information.

  • NIS Slave Server Names - An NIS domain may have more than one NIS server that can handle requests for information from the domain's NIS database. An NIS slave server keeps copies of the NIS maps so that it can respond to requests if the master NIS server goes down. (NIS slave servers are optional.)

If you knew that your network uses NIS when you installed Fedora or RHEL, you may have selected NIS as the way to handle user names and passwords on your computer. If you have not already configured NIS for your computer, the procedures that follow will describe how to do that. The procedures consist of defining your NIS domain name, setting up the /etc/yp.conf file, and configuring NIS client daemons ( ypbind and ypwhich ) to start when you boot your system.

Defining an NIS Domain Name

You can set your Fedora or RHEL computer's NIS domain name using the domainname command. For example, if your NIS domain name were trident , you could set it by typing the following as the root user from the shell:

 #  domainname trident  

To verify that your NIS domain name is set, simply type domainname and you will see the name. Unfortunately, you're not done yet. Running domainname doesn't set the NIS domain name permanently. As soon as you reboot the computer, it is gone. (You can verify this by typing domainname again after a reboot.)

To make the NIS domain name permanent, you need to have the domainname command run automatically each time your system boots. There are many ways to do this. What I did was add the command line ( domainname trident ) to a run-level script that runs before the ypbind daemon is started. I edited the /etc/rc.local file and added the following lines just after the first set of comment lines:

 # Set the NIS domain name. domainname trident 

This caused my NIS domain name to be set each time my Fedora or RHEL system booted . When you add this entry, make sure you spell the NIS domain name properly (including upper- and lowercase letters ). If you get it slightly wrong, you will see ypbind failure messages when you boot. Some version of NIS use the /etc/defaultdomain file as a place for parking the NIS domain name, then source in this file from an init script.

Caution 

Be very careful editing a run-level script. Make a copy before you edit it. If you make a mistake editing one of these files, you could find yourself with a network or other essential service that doesn't work. You also risk losing this information when you upgrade your system at a later date.

Setting Up the /etc/yp.conf File

The ypbind daemon needs information about your NIS domain and NIS servers for it to work. That information is set up in your /etc/yp.conf file. The first entries define your NIS domain name and NIS servers. For example, if you had an NIS domain called trident and a master server called maple , you would have the following entry in your /etc/yp.conf file:

 domain trident server maple 

If you had other slave NIS servers named oak and pine , for example, you could also have the following entries:

 domain trident server oak domain trident server pine 

You can also set your computer to broadcast to the local network for your NIS server. If your domain were named trident , for example, you would use the domain/broadcast option as follows :

 domain trident broadcast 

If the address of your NIS server is contained in your /etc/hosts file, you can specify that ypbind look in that file to find the server's IP address. For example, if your NIS master server is named maple , you would add the following entry:

 ypserver maple 

When ypbind starts, all the information in this file is read. It is then used to contact the appropriate NIS server.

Configuring NIS Client Daemons

After your NIS client information is all set up, all you need to do to run NIS as a client is start the ypbind and ypwhich daemons. The ypbind daemon runs continuously as two processes: The master ypbind process handles requests for information from your NIS server, and the slave ypbind process checks the bindings from time to time. The ypwhich daemon finds your NIS master server.

Getting these daemons running is pretty easy. You can set up an existing run-level script called ypbind to start automatically at boot time. To do this, you can run the following command (as root user from a Terminal window):

 #  chkconfig ypbind on  

To start the ypbind daemon immediately, type:

 #  /etc/init.d/ypbind start  
Cross-Reference 

For more information on run-level scripts, refer to Chapter 12.

Checking that NIS is Working

To check that your NIS client is communicating with your NIS master server, follow the instructions in this section.

Note 

If your NIS server isn't configured yet, refer to the "Setting Up Fedora or RHEL as an NIS Master Server" section later in this chapter to configure your NIS server. Then return to this procedure to make sure that everything is working properly.

From the NIS client computer, type the following command to make sure that you are communicating with the NIS server:

 #  ypwhich  maple 

The output shown here indicates that the NIS client is bound to the NIS server named maple . Next, check that the maps are being shared using the ypcat command. (To see what files are being shared from the NIS server, look in the server's /var/yp/ nisdomain directory, where nisdomain is replaced by your NIS domain name.) Type one of the files shown in that directory along with the ypcat command. Here's an example:

 #  ypcat hosts  10.0.0.45 ash 10.0.0.46 pine 10.0.0.47 maple 

If you are communicating with the NIS server and able to access map files, you can now define which maps the NIS client uses of those shared map files.

Using NIS Maps

For the information being distributed by the NIS server to be used by the NIS client, you must configure the /etc/nsswitch.conf file to include nis in the search path for each file you want to use.

The following is a listing from the /etc/nsswitch.conf file showing valid values that can be in the search paths for accessing different configuration files.

 # Legal entries are: # # nisplus or nis+ Use NIS+ (NIS version 3) # nis or yp Use NIS (NIS version 2), also called YP # dns Use DNS (Domain Name Service) # files Use the local files # db Use the local database (.db) files # compat Use NIS on compat mode # hesiod Use Hesiod for user lookups # [NOTFOUND=return] Stop searching if not found so far # 

For the purposes of this example, I want to add nis in the paths for the files I want to distribute from my NIS server to this NIS client. In most cases, only the local files are checked ( files ). The following are examples of how some entries appear:

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

For each of these entries, the original files are checked first ( /etc/passwd, /etc/shadow , and so on). For host names, the DNS server is checked after the local hosts file. For this example, you can add nis to access the maps being shared from the NIS server. (Linux NIS servers only implement nis and not nisplus .) The lines would then appear as follows:

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

As soon as the /etc/nsswitch file is changed, the data from the NIS maps are accessible. There's no need to restart the NIS service. You can go through and change any of the files listed in the /etc/nsswitch file so that it is configured to let your system access the NIS maps being shared.




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net