YP Client

Setting Up a YP Client #

Setting up a YP client involves two distinct parts. First, you must get the YP client daemon running, binding your client host to a YP server. Completing the following steps will allow you to retrieve data from the YP server, but that data will not yet be used by the system: Like on the server, you must set the domain name and enable the portmapper:

# echo "puffynet" > /etc/defaultdomain
# domainname `cat /etc/defaultdomain`
# rcctl enable portmap
# rcctl start portmap

It is recommended to provide a list of YP servers in the configuration file /etc/yp/domainname. Otherwise, the YP client daemon will use network broadcasts to find YP servers for its domain. Explicitly specifying the servers is both more robust and marginally less open to attack. If you have not set up any slave servers, just put the host name of the master server into /etc/yp/domainname. Enable and start the YP client daemon, ypbind(8).

# rcctl enable ypbind
# rcctl start ypbind

If all went well you should be able to query the YP server using ypcat(1) and see your passwd map returned.

# ypcat passwd
bob:*:5001:5000:Bob Nuggets:/home/bob:/usr/local/bin/zsh
...

Another useful tool for debugging your YP setup is ypmatch(1).

The second part of configuring a YP client involves editing local configuration files such that certain YP maps get used by various system facilities. Not all servers serve all standard maps supported by the operating system, some servers serve additional non-standard maps, and you are by no means compelled to use all those maps. Which of the available maps shall or shall not be used, and for which purposes they shall be used, is fully at the discretion of the client host’s system administrator.

For a list of standard YP maps and their standard usage, see Makefile.yp(8).

If you want to include all user accounts from the YP domain, append the default YP marker to the master password file and rebuild the password database:

# echo '+:*::::::::' >> /etc/master.passwd
# pwd_mkdb -p /etc/master.passwd

For details on selective inclusion and exclusion of user accounts, see passwd(5). To test whether inclusion actually works, use the id(1) utility. If you want to include all groups from the YP domain, append the default YP marker to the group file:

# echo '+:*::' >> /etc/group

For details on selective group inclusion, see group(5).