Section: Linux Programmer's Manual (5)
The Name Service Switch (NSS) configuration file, /etc/nsswitch.conf, is used by the GNU C Library to determine the sources from which to obtain name-service information in a range of categories, and in what order. Each category of information is identified by a database name.
The file is plain ASCII text, with columns separated by spaces or tab characters. The first column specifies the database name. The remaining columns describe the order of sources to query and a limited set of actions that can be performed by lookup result.
The following databases are understood by the GNU C Library:
Here is an example /etc/nsswitch.conf file:
The first column is the database name. The remaining columns specify:
The service specifications supported on your system depend on the presence of shared libraries, and are therefore extensible. Libraries called /lib/libnss_SERVICE.so.X will provide the named SERVICE. On a standard installation, you can use "files", "db", "nis", and "nisplus". For the hosts database, you can additionally specify "dns". For the passwd, group, and shadow databases, you can additionally specify "compat" (see Compatibility mode below). The version number X may be 1 for glibc 2.0, or 2 for glibc 2.1 and later. On systems with additional libraries installed, you may have access to further services such as "hesiod", "ldap", "winbind" and "wins".
An action may also be specified following a service specification. The action modifies the behavior following a result obtained from the preceding data source. Action items take the general form:
:STATUS => success | notfound | unavail | tryagain
ACTION => return | continue:
The ! negates the test, matching all possible results except the one specified. The case of the keywords is not significant.
The STATUS value is matched against the result of the lookup function called by the preceding service specification, and can be one of:
The ACTION value can be one of:
The NSS "compat" service is similar to "files" except that it additionally permits special entries in /etc/passwd for granting users or members of netgroups access to the system. The following entries are valid in this mode:
A service named SERVICE is implemented by a shared object library named libnss_SERVICE.so.X that resides in /lib.
Within each process that uses nsswitch.conf, the entire file is read only once. If the file is later changed, the process will continue using the old configuration.
Traditionally, there was only a single source for service information, often in the form of a single configuration file (e.g., /etc/passwd). However, as other name services, such as the Network Information Service (NIS) and the Domain Name Service (DNS), became popular, a method was needed that would be more flexible than fixed search orders coded into the C library. The Name Service Switch mechanism, which was based on the mechanism used by Sun Microsystems in the Solaris 2 C library, introduced a cleaner solution to the problem.
This page is part of release 3.74 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at http://www.kernel.org/doc/man-pages/.
Tutoriais de Tecnologia Web