1 .\" $NetBSD: nsswitch.conf.5,v 1.14 1999/03/17 20:19:47 garbled Exp $
2 .\" $FreeBSD: src/share/man/man5/nsswitch.conf.5,v 1.8 2002/12/12 22:22:51 trhodes Exp $
3 .\" $DragonFly: src/share/man/man5/nsswitch.conf.5,v 1.1 2003/08/01 04:11:23 rob Exp $
5 .\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
6 .\" All rights reserved.
8 .\" This code is derived from software contributed to The NetBSD Foundation
11 .\" Redistribution and use in source and binary forms, with or without
12 .\" modification, are permitted provided that the following conditions
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\" notice, this list of conditions and the following disclaimer.
16 .\" 2. Redistributions in binary form must reproduce the above copyright
17 .\" notice, this list of conditions and the following disclaimer in the
18 .\" documentation and/or other materials provided with the distribution.
19 .\" 3. All advertising materials mentioning features or use of this software
20 .\" must display the following acknowledgement:
21 .\" This product includes software developed by Luke Mewburn.
22 .\" 4. The name of the author may not be used to endorse or promote products
23 .\" derived from this software without specific prior written permission.
25 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
31 .\" OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33 .\" TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
34 .\" 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, and
53 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
76 Internet Domain Name System.
82 class entries, all other databases use
84 class (Hesiod) entries.
95 If this is present, it must be the only source for that entry.
98 The following databases are used by the following C library functions:
100 .Bl -tag -width networks -compact
115 The following status codes are available:
117 .Bl -tag -width tryagain -compact
121 The requested entry was found.
123 The entry is not present at this source.
125 The source is busy, and may respond to retries.
127 The source is not responding, or entry is corrupt.
130 For each of the status codes, one of two actions is possible:
132 .Bl -tag -width continue -compact
138 Return with the current result
143 description of the syntax of
147 .Bl -tag -width <criterion> -compact
150 <database> ":" [<source> [<criteria>]]*
156 <status> "=" <action>
159 "success" | "notfound" | "unavail" | "tryagain"
162 "return" | "continue"
165 Each entry starts on a new line in the file.
168 delimits a comment to end of line.
169 Blank lines are ignored.
172 at the end of a line escapes the newline, and causes the next line to
173 be a continuation of the current line.
174 All entries are case-insensitive.
176 The default criteria is to return on
178 and continue on anything else (i.e,
179 .Li "[success=return notfound=continue unavail=continue tryagain=continue]" ) .
180 .Ss Compat mode: +/- syntax
181 In historical multi-source implementations, the
185 characters are used to specify the importing of user password and
186 group information from
190 provides alternative methods of accessing distributed sources such as
192 specifying a sole source of
194 will provide the historical behaviour.
196 An alternative source for the information accessed via
198 can be used by specifying
199 .Dq passwd_compat: source .
205 any other source except for
210 Historically, many of the databases had enumeration functions, often of
213 These made sense when the databases were in local files, but don't make
214 sense or have lesser relevance when there are possibly multiple sources,
215 each of an unknown size.
216 The interfaces are still provided for compatibility, but the source
217 may not be able to provide complete entries, or duplicate entries may
218 be retrieved if multiple sources that contain similar information are
221 To ensure compatibility with previous and current implementations, the
223 source must appear alone for a given database.
224 .Ss Default source lists
227 doesn't exist, or it has missing or corrupt entries,
229 will default to an entry of
231 for the requested database.
234 .Bl -tag -width passwd_compat -compact
236 .Sy "Default source list"
249 .Bl -tag -width /etc/nsswitch.conf -compact
250 .It Pa /etc/nsswitch.conf
259 and then from the DNS, and lookup user information from
263 .Bl -tag -width passwd: -compact
267 nis [notfound=return] files
269 nis [notfound=return] files
273 .Dq [notfound=return]
274 sets a policy of "if the user is notfound in nis, don't try files."
275 This treats nis as the authoritative source of information, except
276 when the server is down.
285 file format first appeared in
287 It was imported from the
289 Project, where it appeared first in
294 wrote this freely distributable name-service switch implementation,