|
NAMEnsswitch.conf —
name-service switch configuration file
DESCRIPTIONThensswitch.conf file specifies how the
nsdispatch(3)
(name-service switch dispatcher) routines in the C library should operate.
The configuration file controls how a process looks up various
databases containing information regarding hosts, users (passwords), groups,
etc. Each database comes from a source (such as local files, DNS, NIS , and
cache), and the order to look up the sources is specified in
Each entry in SourcesThe following sources are implemented as part of the base system:
Additional sources might be provided by third party software. DatabasesThe following databases are used by the following C library functions:
Status codesThe following status codes are available:
ActionsFor each of the status codes, one of two actions is possible:
Format of fileA BNF description of the syntax ofnsswitch.conf is:
Each entry starts on a new line in the file. A ‘#’ delimits a comment to end of line. Blank lines are ignored. A ‘\’ at the end of a line escapes the newline, and causes the next line to be a continuation of the current line. All entries are case-insensitive. The default criteria is to return on “success”, and
continue on anything else (i.e, CacheYou can enable caching for the particular database by specifying “cache” in thensswitch.conf file. It
should come after “files”, but before remote sources like
“nis”. You should also enable caching for this database in
nscd.conf(5).
If for a particular query “cache” source returns success, then
no further sources are queried. On the other hand, if there are no previously
cached data, the query result will be placed into the cache right after all
other sources are processed. Note that “cache” requires the
nscd(8)
daemon to be running.
Compat mode: +/- syntaxIn historical multi-source implementations, the ‘+’ and ‘-’ characters are used to specify the importing of user password and group information from NIS . Althoughnsswitch.conf provides alternative methods of
accessing distributed sources such as NIS , specifying a sole source of
“compat” will provide the historical behaviour.
An alternative source for the information accessed via ‘+/-’ can be used by specifying “passwd_compat: source”. “source” in this case can be ‘dns’, ‘nis’, or any other source except for ‘files’ and ‘compat’. NotesHistorically, many of the databases had enumeration functions, often of the formgetXXXent (). These made sense when the databases were
in local files, but do not make sense or have lesser relevance when there are
possibly multiple sources, each of an unknown size. The interfaces are still
provided for compatibility, but the source may not be able to provide complete
entries, or duplicate entries may be retrieved if multiple sources that
contain similar information are specified.
To ensure compatibility with previous and current implementations, the “compat” source must appear alone for a given database. Default source listsIf, for any reason,nsswitch.conf does not exist, or it
has missing or corrupt entries,
nsdispatch(3)
will default to an entry of “files” for the requested database.
Exceptions are:
FILES
EXAMPLESTo lookup hosts in /etc/hosts , then in cache, and then from the DNS, and lookup user information from NIS then files, use:
The criteria “[notfound=return]” sets a policy of "if the user is notfound in nis, do not try files." This treats nis as the authoritative source of information, except when the server is down. NOTESThensswitch.conf file is parsed by each program only
once. Subsequent changes will not be applied until the program is restarted.
If system got compiled with WITHOUT_NIS you have to remove ‘nis’ entries. FreeBSD's Standard
C Library (libc, -lc) provides stubs for compatibility with
NSS modules written for the GNU C Library SEE ALSOnsdispatch(3), nscd.conf(5), resolv.conf(5), nscd(8), ypbind(8)HISTORYThensswitch.conf file format first appeared in
FreeBSD 5.0. It was imported from the
NetBSD Project, where it appeared first in
NetBSD 1.4.
AUTHORSLuke Mewburn <lukem@netbsd.org> wrote this freely distributable name-service switch implementation, using ideas from the ULTRIX svc.conf(5) and Solaris nsswitch.conf(4) manual pages.
Visit the GSP FreeBSD Man Page Interface. |