1 .\" Copyright (c) 1998, 1999 Thorsten Kukuk (kukuk@vt.uni-paderborn.de)
2 .\" Copyright (c) 2011, Mark R. Bannister <cambridge@users.sourceforge.net>
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .TH NSSWITCH.CONF 5 2017-05-03 "Linux" "Linux Programmer's Manual"
27 nsswitch.conf \- Name Service Switch configuration file
29 The Name Service Switch (NSS) configuration file,
30 .IR /etc/nsswitch.conf ,
31 is used by the GNU C Library and certain other applications to determine
32 the sources from which to obtain name-service information in
33 a range of categories,
35 Each category of information is identified by a database name.
37 The file is plain ASCII text, with columns separated by spaces or tab
39 The first column specifies the database name.
40 The remaining columns describe the order of sources to query and a
41 limited set of actions that can be performed by lookup result.
43 The following databases are understood by the GNU C Library:
48 and related functions.
54 Groups of users, used by
56 and related functions.
59 Host names and numbers, used by
61 and related functions.
64 Supplementary group access list, used by
69 Network-wide list of hosts and users, used for access rules.
70 C libraries before glibc 2.1 supported netgroups only over NIS.
73 Network names and numbers, used by
75 and related functions.
78 User passwords, used by
80 and related functions.
83 Network protocols, used by
85 and related functions.
88 Public and secret keys for Secure_RPC used by NFS and NIS+.
91 Remote procedure call names and numbers, used by
93 and related functions.
96 Network services, used by
98 and related functions.
101 Shadow user passwords, used by
103 and related functions.
105 The GNU C Library ignores databases with unknown names.
106 Some applications use this to implement special handling for their own
115 .I /etc/nsswitch.conf
124 hosts: dns [!UNAVAIL=return] files
125 networks: nis [NOTFOUND=return] files
126 ethers: nis [NOTFOUND=return] files
127 protocols: nis [NOTFOUND=return] files
128 rpc: nis [NOTFOUND=return] files
129 services: nis [NOTFOUND=return] files
133 The first column is the database name.
134 The remaining columns specify:
136 One or more service specifications, for example, "files", "db", or "nis".
137 The order of the services on the line determines the order in which
138 those services will be queried, in turn, until a result is found.
140 Optional actions to perform if a particular result is obtained
141 from the preceding service, for example, "[NOTFOUND=return]".
143 The service specifications supported on your system depend on the
144 presence of shared libraries, and are therefore extensible.
146 .IB /lib/libnss_SERVICE.so. X
147 will provide the named
149 On a standard installation, you can use
150 "files", "db", "nis", and "nisplus".
153 database, you can additionally specify "dns".
159 databases, you can additionally specify
161 .B "Compatibility mode"
165 may be 1 for glibc 2.0, or 2 for glibc 2.1 and later.
166 On systems with additional libraries installed, you may have access to
167 further services such as "hesiod", "ldap", "winbind", and "wins".
169 An action may also be specified following a service specification.
170 The action modifies the behavior following a result obtained
171 from the preceding data source.
172 Action items take the general form:
175 .RI [ STATUS = ACTION ]
177 .RI [! STATUS = ACTION ]
202 The ! negates the test, matching all possible results except the
204 The case of the keywords is not significant.
208 value is matched against the result of the lookup function called by
209 the preceding service specification, and can be one of:
213 No error occurred and the requested entry is returned.
214 The default action for this condition is "return".
217 The lookup succeeded, but the requested entry was not found.
218 The default action for this condition is "continue".
221 The service is permanently unavailable.
222 This can mean either that the
223 required file cannot be read, or, for network services, that the server
224 is not available or does not allow queries.
225 The default action for this condition is "continue".
228 The service is temporarily unavailable.
229 This could mean a file is
230 locked or a server currently cannot accept more connections.
231 The default action for this condition is "continue".
241 Do not call any further lookup functions.
242 However, for compatibility reasons, if this is the selected action for the
246 status, and the configuration file does not contain the
248 line, the next lookup function is always called,
249 without affecting the search result.
252 Call the next lookup function.
256 is used between two database entries.
257 When a group is located in the first of the two group entries,
258 processing will continue on to the next one.
259 If the group is also found in the next entry (and the group name and GID
260 are an exact match), the member list of the second entry will be added
261 to the group object to be returned.
262 Available since glibc 2.24.
263 Note that merging will not be done for
265 nor will duplicate members be pruned when they occur in both entries
268 .SS Compatibility mode (compat)
269 The NSS "compat" service is similar to "files" except that it
270 additionally permits special entries in corresponding files
271 for granting users or members of netgroups access to the system.
272 The following entries are valid in this mode:
283 Include the specified
285 from the NIS passwd/shadow map.
288 Include all users in the given
292 Exclude the specified
294 from the NIS passwd/shadow map.
297 Exclude all users in the given
301 Include every user, except previously excluded ones, from the
302 NIS passwd/shadow map.
311 Include the specified
313 from the NIS group map.
316 Exclude the specified
318 from the NIS group map.
321 Include every group, except previously excluded ones, from the
326 By default, the source is "nis", but this may be
327 overridden by specifying any NSS service except "compat" itself
328 as the source for the pseudo-databases
336 is implemented by a shared object library named
337 .IB libnss_SERVICE.so. X
343 .I /etc/nsswitch.conf
344 NSS configuration file.
346 .IB /lib/libnss_compat.so. X
347 implements "compat" source.
349 .IB /lib/libnss_db.so. X
350 implements "db" source.
352 .IB /lib/libnss_dns.so. X
353 implements "dns" source.
355 .IB /lib/libnss_files.so. X
356 implements "files" source.
358 .IB /lib/libnss_hesiod.so. X
359 implements "hesiod" source.
361 .IB /lib/libnss_nis.so. X
362 implements "nis" source.
364 .IB /lib/libnss_nisplus.so. X
365 implements "nisplus" source.
369 The following files are read when "files" source is specified
370 for respective databases:
415 Within each process that uses
417 the entire file is read only once.
418 If the file is later changed, the
419 process will continue using the old configuration.
421 Traditionally, there was only a single source for service information,
422 often in the form of a single configuration
423 file (e.g., \fI/etc/passwd\fP).
424 However, as other name services, such as the Network Information
425 Service (NIS) and the Domain Name Service (DNS), became popular,
427 that would be more flexible than fixed search orders coded into
429 The Name Service Switch mechanism,
430 which was based on the mechanism used by
431 Sun Microsystems in the Solaris 2 C library,
432 introduced a cleaner solution to the problem.