It's now time to face up to some distortions we've been making for the sake of simplicity. We've assumed that there's a one-to-one correspondence between files and maps. In fact, there are usually several maps for each file. A map really corresponds to a particular way of accessing a file: for example, the passwd.byname map looks up data in the password database by username. There's also a passwd.byuid that looks up users according to their user ID number. There could be (but there aren't) additional maps that looked up users on the basis of their group ID number, home directory, or even their choice of login shell. To make things a bit easier, the most commonly used maps have "nicknames," which correspond directly to the name of the original file: for example, the nickname for passwd.byname is simply passwd. Using nicknames as if they were map names rarely causes problems -- but it's important to realize that there is a distinction. It's also important to realize that nicknames are recognized by only two NIS utilities: ypmatch and ypcat.
(hostname, username, domain name)
source (-,stern,nesales), (-,julie,nesales), (-,peter,nesales) trusted-hosts (bitatron,,), (corvette,,) trusted-users (bitatron,stern,), (corvette,johnc,) dangerous-users (,jimc,), (,dave,)
hosts-n-users trusted-hosts, trusted-users
passwd: files nis
TIP: The default files and NIS integration will have your clients getting hostname and address information from NIS. Since you will likely have DNS running, you will find it better to get host informaton from DNS. See Chapter 5, "Living with Multiple Directory Servers ".
addresses.dir index file addresses.pag data file
filename.bykeyname
passwd.byname.dir passwd.byname.pag passwd.byuid.dir passwd.byuid.pag
% ypmatch stern passwd stern:passwd:1461:10:Hal Stern:/home/thud/stern:/bin/csh
nisclient# domainname nesales
/usr/bin/domainname `cat /etc/defaultdomain`
/var/yp/domainname/mapname
ypserv: Domain financials not supported (broadcast)
# cat /dev/null > /var/yp/ypserv.log
% domainname nesales % ypwhich wahoo
gonzo% ypwhich -d financials Domain financials not bound on gonzo
client# cp /etc/nsswitch.files /etc/nsswitch.conf
Copyright © 2002 O'Reilly & Associates. All rights reserved.