Using NIS Clients

Configuring your computer as an NIS client is easy; all you need to do is edit /etc/yp.conf and run the ypbind command. If you want to set up the computer as a permanent NIS client, just remember to run the chkconfig --level 345 ypbind on command to make sure that it starts at the appropriate runlevels.

There are a number of yp based commands that can help you test your connection. To make sure your NIS client computer actually uses some of the database map files, you must configure the /etc/nsswitch.conf file.

NIS Client Configuration in yp.conf

It s easy to configure an NIS client. Open /etc/yp.conf in a text editor. You ll see three basic commands:

 domain  NISDOMAIN  server  HOSTNAME  domain  NISDOMAIN  broadcast ypserver  HOSTNAME  

The entries here are straightforward. Substitute the name of your NIS domain for NISDOMAIN . Substitute the name of the computer with the NIS server for HOSTNAME . If you also have a slave server, add the following command:

 domain  NISDOMAIN  server  NISSLAVEHOSTNAME  

where NISSLAVEHOSTNAME is the hostname of the NIS slave server. Now you re ready to start the NIS client with the service ypbind start command.

Tip  

If ypbind is having problems communicating with the NIS server, check for a firewall on the NIS server ”it may be blocking NIS communication. Generally, NIS should be run on a LAN protected only from outside networks by a firewall.

NIS Client Commands

There are a number of commands that you can use as an NIS client. Conveniently, they all start with the letters yp. They enable you to set passwords on the remote NIS server database, test the connection, read files from the NIS server database, and more. We take a look at these commands in the following sections.

ypcat

The ypcat command reads files available from an NIS server database. Like the regular cat command, it just scrolls the information available from the file. However, what you see in an NIS client may vary slightly from the actual file on the server. For example, the following command just lists the /etc/passwd information for users with an UID >= 500 (unless you ve changed the MINUID and MINGID variables in /var/yp/Makefile ):

 # ypcat passwd 

ypchfn

The ypchfn command changes the finger information on the NIS server database map. Like the chfn command, it normally applies to the current user . If you re in the root account, you run the chfn username command to change the finger information for the user of your choice.

As described in Chapter 23 , you can store finger information, such as a user s full name and telephone number, in the fifth field of that user s entry in /etc/passwd .

Thus, the following command prompts you to change the finger information for user mj on the RHL9 NIS server. It also provides a series of prompts to help you revise user mj s finger information:

 # ypchfn mj Changing NIS account information for mj on RHL9. Please enter root password: Changing full name for mj on RHL9. To accept the default, simply press return. To enter an empty field, type the word "none". Name [Michael Jang]: 

ypchsh

The ypchsh username command changes the default shell for a specific user in the NIS server s /etc/passwd file. It works in a similar way to ypchfn; this command prompts you for the NIS server root password, and then prompts you to change the shell.

ypmatch

The ypmatch username passwd command is an easy way to search through the NIS database file for your LAN s username entry in the master NIS server s /etc/passwd file.

yppasswd

The yppasswd username command allows you to change the password for a user on the NIS server. The user will have to use the new password to log onto any NIS client computers. Like the ypchfn and ypchsh commands, you re prompted for the NIS server root password before you re prompted to enter the new password for the desired user.

yppush

If you ve recently changed the NIS database on the master server, the yppush command forces that master server to send a copy of the revised database maps to any NIS slave servers listed in the /var/yp/ypservers file.

Configuring
/etc/nsswitch.conf

If you have an NIS server on your network, you ll want to make sure that the /etc/nsswitch.conf file on the NIS client looks for an NIS server for any associated configuration files. It also can point your client computer to other sources, such as the local configuration files.

For example, if you don t have an NIS server, your /etc/nsswitch.conf should be simple, with commands like these:

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

Each of these commands specifies a search order. For example, the hosts line specifies a search through the local file ( /etc/hosts ) before moving on to a DNS server (which matches the configuration in ( /etc/host.conf ). However, if you have an NIS server, you should include it in the list. For example, the following lines look to a properly bound NIS server database first:

 passwd:  nis files shadow:  nis files group:   nisfiles 

The nis entry corresponds to the standard NIS server. If you re using NIS version 3. x , you ll want to replace that entry with nisplus .

If you want to use the central NIS server /etc/hosts database, add a corresponding entry in /etc/host.conf . For example, the following directs your computer to first search through the NIS /etc/hosts database, then search the local /etc/hosts , and then finally search any DNS servers in /etc/resolv.conf :

 order nis,hosts,bind 
 


Mastering Red Hat Linux 9
Building Tablet PC Applications (Pro-Developer)
ISBN: 078214179X
EAN: 2147483647
Year: 2005
Pages: 220

Similar book on Amazon

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