1 .\" $NetBSD: nsswitch.conf.5,v 1.14 1999/03/17 20:19:47 garbled Exp $
3 .\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\" must display the following acknowledgement:
19 .\" This product includes software developed by Luke Mewburn.
20 .\" 4. The name of the author may not be used to endorse or promote products
21 .\" derived from this software without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29 .\" OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
31 .\" TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32 .\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 .Nd name-service switch configuration file
45 file specifies how the
47 (name-service switch dispatcher) routines in the C library should operate.
49 The configuration file controls how a process looks up various databases
50 containing information regarding hosts, users (passwords), groups, etc.
51 Each database comes from a source (such as local files, DNS,
53 and cache), and the order to look up the sources is specified in
58 consists of a database name, and a space separated list of sources.
59 Each source can have an optional trailing criterion that determines
60 whether the next listed source is used, or the search terminates at
62 Each criterion consists of one or more status codes, and actions to
63 take if that status code occurs.
65 The following sources are implemented:
67 .Bl -tag -width Source -compact
78 Internet Domain Name System.
84 class entries, all other databases use
86 class (Hesiod) entries.
97 If this is present, it must be the only source for that entry.
104 The following databases are used by the following C library functions:
106 .Bl -tag -width networks -compact
118 .Xr gethostbyaddr 3 ,
119 .Xr gethostbyaddr_r 3 ,
120 .Xr gethostbyname 3 ,
121 .Xr gethostbyname2 3 ,
122 .Xr gethostbyname_r 3 ,
123 .Xr getipnodebyaddr 3 ,
124 .Xr getipnodebyname 3
127 .Xr getnetbyaddr_r 3 ,
143 .Xr getrpcbynumber 3 ,
146 .Xr getprotobyname 3 ,
147 .Xr getprotobynumber 3 ,
155 The following status codes are available:
157 .Bl -tag -width tryagain -compact
161 The requested entry was found.
163 The entry is not present at this source.
165 The source is busy, and may respond to retries.
167 The source is not responding, or entry is corrupt.
170 For each of the status codes, one of two actions is possible:
172 .Bl -tag -width continue -compact
178 Return with the current result
183 description of the syntax of
187 .Bl -tag -width <criterion> -compact
190 <database> ":" [<source> [<criteria>]]*
196 <status> "=" <action>
199 "success" | "notfound" | "unavail" | "tryagain"
202 "return" | "continue"
205 Each entry starts on a new line in the file.
208 delimits a comment to end of line.
209 Blank lines are ignored.
212 at the end of a line escapes the newline, and causes the next line to
213 be a continuation of the current line.
214 All entries are case-insensitive.
216 The default criteria is to return on
218 and continue on anything else (i.e,
219 .Li "[success=return notfound=continue unavail=continue tryagain=continue]" ) .
221 You can enable caching for the particular database by specifying
223 as the first source in the
226 You should also enable caching for this database in
228 If for the particular query
230 source returns success, no further sources are queried.
231 On the other hand, if there are no previously cached data, the
232 query result will be placed into the cache right after
233 all other sources are processed.
238 daemon to be running.
239 .Ss Compat mode: +/- syntax
240 In historical multi-source implementations, the
244 characters are used to specify the importing of user password and
245 group information from
249 provides alternative methods of accessing distributed sources such as
251 specifying a sole source of
253 will provide the historical behaviour.
255 An alternative source for the information accessed via
257 can be used by specifying
258 .Dq passwd_compat: source .
264 any other source except for
269 Historically, many of the databases had enumeration functions, often of
272 These made sense when the databases were in local files, but do not make
273 sense or have lesser relevance when there are possibly multiple sources,
274 each of an unknown size.
275 The interfaces are still provided for compatibility, but the source
276 may not be able to provide complete entries, or duplicate entries may
277 be retrieved if multiple sources that contain similar information are
280 To ensure compatibility with previous and current implementations, the
282 source must appear alone for a given database.
283 .Ss Default source lists
286 does not exist, or it has missing or corrupt entries,
288 will default to an entry of
290 for the requested database.
293 .Bl -tag -width services_compat -compact
295 .Sy "Default source list"
312 .Bl -tag -width /etc/nsswitch.conf -compact
313 .It Pa /etc/nsswitch.conf
320 To lookup hosts in cache, then in
322 and then from the DNS, and lookup user information from
326 .Bl -tag -width passwd: -compact
330 nis [notfound=return] files
332 nis [notfound=return] files
336 .Dq [notfound=return]
337 sets a policy of "if the user is notfound in nis, do not try files."
338 This treats nis as the authoritative source of information, except
339 when the server is down.
341 If system got compiled with
349 provides stubs for compatibility with NSS modules
355 However, these stubs only support the use of the
370 file format first appeared in
372 It was imported from the
374 Project, where it appeared first in
379 wrote this freely distributable name-service switch implementation,