[Next] [Previous] [Up] [Top] [Contents]

21.2 NIS

21.2.1 Initialization

Install the NIS software during installation with suninstall, or later with /usr/etc/install/add_services.

Initialize the NIS domain by running /usr/etc/ypserv, on the server and on its clients running /usr/etc/ypbind. This is done in /etc/rc.local. The NIS servers can also be NIS clients. You can have slave servers for redundancy.

You need to specify a domainname, e.g. department, etc. in /etc/rc.local. This is completely separate from the IP domain name. Normally the NIS domainname is put in the file /etc/defaultdomain for use during startup. If this file does not exist or has the contents "noname", it is assumed that you are not using NIS. The domainname can be set or displayed with the domainname command.

You originally set up the NIS databases on the server with the command /usr/etc/yp/ypinit -m/s (master/slave). In the simple case the server is the master for all maps in the database. All databases are built from scratch with ypinit. To update changed databases, e.g. after installing a new user:

# cd /var/yp; make

This will push the new databases to all the machines in the NIS domain.

If you have more than one NIS server you may wish to bind a particular machine with a specific server. This can be done with the ypset command in conjunction with using the -ypset option to ypbind.

To display your current NIS server use the ypwhich command.

To display contents of the NIS tables you can use the ypcat and ypmatch commands. ypcat lists the specified table. ypmatch matches a keyword with the specified table, e.g.:

% ypmatch frank passwd
frank:jkl/fdasjklKY:101:10:Frank G Fiamingo:/home/tardis/frank:/usr/bin/tcsh

Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]