ypfiles -- the Network Information Service database and directory structure


The Network Information Service (NIS) lookup service uses a database of dbm files in the directory hierarchy /etc/yp. A dbm database consists of two files which are created by calls to the dbm(NS) library package. One has the filename extension .pag and the other has the filename extension .dir. For instance, the database named hosts.nam is implemented by the pair of files hosts.nam.pag and hosts.nam.dir. A dbm database served by NIS is called an NIS map. An NIS domain is a named set of NIS maps. Each NIS domain is implemented as a subdirectory of /etc/yp containing the map. Any number of NIS domains can exist; each such domain may contain any number of NIS maps.

No maps are required by the NIS lookup service itself, although they may be required for the normal operation of other parts of the system. There is no list of maps which NIS serves: if the map exists in a given domain and if a client asks about it, NIS will serve it. For a map to be accessible consistently, it must exist on all NIS servers serving the domain. To provide data consistency among the replicated maps, an entry to run ypxfr(NADM) periodically should be made in /usr/lib/crontab on each server. More information on this topic is in ypxfr(NADM)

NIS maps should contain two distinguished key-value pairs. The first is the key, YP_LAST_MODIFIED, which contains a ten-character ASCII order number. This order number should be the UNIX time in seconds when the map was built. The second key is YP_MASTER_NAME, with the name of the NIS master server as a value. makedbm(NADM) generates both key-value pairs automatically. A map that does not contain both key-value pairs can be served by the NIS, but the ypserv(NADM) process will be unable to return values for Get order number or Get master name requests. In addition, the values of these two keys are used by ypxfr when it transfers a map from a master NIS server to a slave. If ypxfr cannot figure out where to get the map or if it cannot determine whether the local copy is more recent than the copy at the master, you must set extra command line switches when you run it.

NIS maps must be generated and modified only at the master server. They are copied to the slaves using ypxfr to avoid potential byte-ordering problems among NIS servers running on machines with different architectures and to minimize the amount of disk space required for the dbm files. The NIS database can be initially set up for both masters and slaves by using ypinit(NADM) or mkdev nis.

After the server databases are set up, it is probable that the contents of some maps will change. In general, some ASCII source version of the database exists on the master; it can be changed with a standard text editor. The update is incorporated into the NIS map and is propagated from the master to the slaves by running /etc/yp/ypmake. All initially supplied maps have corresponding entries in /etc/yp/ypmake; if you add an NIS map, you should edit this file to support the new map. The script uses makedbm to generate the NIS map on the master and yppush(NADM) to propagate the changed map to the slaves. yppush is a client of the map, ypservers, which lists all the NIS servers.

See also

makedbm(NADM), rpcinfo(NADM), ypinit(NADM), ypmake(NADM), yppoll(NADM), yppush(NADM), ypserv(NADM), ypxfr(NADM)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005