1 .\" $NetBSD: nsswitch.conf.5,v 1.28 2009/10/25 01:30:48 wiz 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.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd name-service switch configuration file
39 file specifies how the
41 (name-service switch dispatcher) routines in the C library should operate.
43 The configuration file controls how a process looks up various databases
44 containing information regarding hosts, users (passwords), groups,
46 Each database comes from a source (such as local files, DNS, and
48 and the order to look up the sources is specified in
53 consists of a database name, and a space separated list of sources.
54 Each source can have an optional trailing criterion that determines
55 whether the next listed source is used, or the search terminates at
57 Each criterion consists of one or more status codes, and actions to
58 take if that status code occurs.
60 The following sources are implemented:
61 .Bl -column "multicast_dns" -offset indent -compact
62 .It Sy Source Description
63 .It files Local files, such as
67 .It dns Internet Domain Name System.
73 class entries, all other databases use
75 class (Hesiod) entries.
80 lookups, acting as both a system-wide cache for normal unicast DNS
81 as well as providing multicast DNS
86 only for multicast DNS
89 This would normally be used in conjunction with
91 which would then provide unicast DNS resolver functions.
92 .It nis NIS (formerly YP)
100 If this is present, it must be the only source for that entry.
103 The following databases are used by the following C library functions:
104 .Bl -column "netgroup" -offset indent -compact
105 .It Sy Database Used by
106 .It group Ta Xr getgrent 3
107 .It hosts Ta Xr gethostbyname 3
108 .It netgroup Ta Xr getnetgrent 3
109 .It networks Ta Xr getnetbyname 3
110 .It passwd Ta Xr getpwent 3
111 .It shells Ta Xr getusershell 3
114 The following status codes are available:
115 .Bl -column "tryagain" -offset indent -compact
116 .It Sy Status Description
117 .It success The requested entry was found.
118 .It notfound The entry is not present at this source.
119 .It tryagain The source is busy, and may respond to retries.
120 .It unavail The source is not responding, or entry is corrupt.
123 For each of the status codes, one of two actions is possible:
124 .Bl -column "continue" -offset indent -compact
125 .It Sy Action Description
126 .It continue Try the next source
127 .It return Return with the current result
132 description of the syntax of
135 .Bl -column "\*[Lt]criterion\*[Gt]" -offset indent
136 .It \*[Lt]entry\*[Gt] ::=
137 \*[Lt]database\*[Gt] ":" [\*[Lt]source\*[Gt] [\*[Lt]criteria\*[Gt]]]*
138 .It \*[Lt]criteria\*[Gt] ::=
139 "[" \*[Lt]criterion\*[Gt]+ "]"
140 .It \*[Lt]criterion\*[Gt] ::=
141 \*[Lt]status\*[Gt] "=" \*[Lt]action\*[Gt]
142 .It \*[Lt]status\*[Gt] ::=
143 "success" | "notfound" | "unavail" | "tryagain"
144 .It \*[Lt]action\*[Gt] ::=
145 "return" | "continue"
148 Each entry starts on a new line in the file.
151 delimits a comment to end of line.
152 Blank lines are ignored.
155 at the end of a line escapes the newline, and causes the next line to
156 be a continuation of the current line.
157 All entries are case-insensitive.
159 The default criteria is to return on
161 and continue on anything else (i.e,
162 .Li [success=return notfound=continue unavail=continue tryagain=continue]
164 .Ss Compat mode: +/- syntax
165 In historical multi-source implementations, the
169 characters are used to specify the importing of user password and
170 group information from
174 provides alternative methods of accessing distributed sources such as
176 specifying a sole source of
178 will provide the historical behaviour.
180 An alternative source for the information accessed via
182 can be used by specifying
183 .Dq passwd_compat: source .
189 any other source except for
194 Historically, many of the databases had enumeration functions, often of
197 These made sense when the databases were in local files, but don't make
198 sense or have lesser relevance when there are possibly multiple sources,
199 each of an unknown size.
200 The interfaces are still provided for compatibility, but the source
201 may not be able to provide complete entries, or duplicate entries may
202 be retrieved if multiple sources that contain similar information are
205 To ensure compatibility with previous and current implementations, the
207 source must appear alone for a given database.
208 .Ss Default source lists
211 doesn't exist, or it has missing or corrupt entries,
213 will default to an entry of
215 for the requested database.
217 .Bl -column passwd_compat "files dns" -offset indent
218 .It Sy Database Default source list
222 .It netgroup files [notfound=return] nis
224 .It passwd_compat nis
227 .Bl -tag -width /etc/nsswitch.conf -compact
228 .It Pa /etc/nsswitch.conf
237 and then from the DNS, and lookup user information from
240 .Bl -column "passwd:" -offset indent
242 .It passwd: nis [notfound=return] files
243 .It group: nis [notfound=return] files
247 .Dq [notfound=return]
248 sets a policy of "if the user is notfound in nis, don't try files."
249 This treats nis as the authoritative source of information, except
250 when the server is down.
260 file format first appeared in
265 wrote this freely distributable name-service switch implementation,