7.5. The
nsswitch.conf File
The Network Services switch file /etc/nsswitch.conf determines
the order of lookups performed when a certain piece of information
is requested, just like the /etc/host.conf file which determines
the way host lookups are performed. For example, the line
specifies that host lookup functions should first look in the
local /etc/hosts file, followed by a NIS lookup and finally through
the domain name service (/etc/resolv.conf and named), at which
point if no match is found an error is returned. This file must be
readable for every user! You can find more information in the
man-page nsswitch.5 or nsswitch.conf.5.
A good /etc/nsswitch.conf file for NIS is:
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the /var/db databases
# [NOTFOUND=return] Stop searching if not found so far
#
passwd: compat
group: compat
# For libc5, you must use shadow: files nis
shadow: compat
passwd_compat: nis
group_compat: nis
shadow_compat: nis
hosts: nis files dns
services: nis [NOTFOUND=return] files
networks: nis [NOTFOUND=return] files
protocols: nis [NOTFOUND=return] files
rpc: nis [NOTFOUND=return] files
ethers: nis [NOTFOUND=return] files
netmasks: nis [NOTFOUND=return] files
netgroup: nis
bootparams: nis [NOTFOUND=return] files
publickey: nis [NOTFOUND=return] files
automount: files
aliases: nis [NOTFOUND=return] files
|
passwd_compat, group_compat and shadow_compat are only supported
by glibc 2.x. If there are no shadow rules in /etc/nsswitch.conf,
glibc will use the passwd rule for lookups. There are some more
lookup module for glibc like hesoid. For more information, read the
glibc documentation.