1NSSWITCH.CONF(5)           Linux Programmer's Manual          NSSWITCH.CONF(5)
2
3
4

NAME

6       nsswitch.conf - Name Service Switch configuration file
7

DESCRIPTION

9       The  Name  Service Switch (NSS) configuration file, /etc/nsswitch.conf,
10       is used by the GNU C Library to determine the  sources  from  which  to
11       obtain  name-service  information in a range of categories, and in what
12       order.  Each category of information is identified by a database name.
13
14       The file is plain ASCII text, with columns separated by spaces  or  tab
15       characters.  The first column specifies the database name.  The remain‐
16       ing columns describe the order of sources to query and a limited set of
17       actions that can be performed by lookup result.
18
19       The following databases are understood by the GNU C Library:
20
21       aliases     Mail aliases, used by getaliasent(3) and related functions.
22
23       ethers      Ethernet numbers.
24
25       group       Groups of users, used by getgrent(3) and related functions.
26
27       hosts       Host  names  and  numbers,  used  by  gethostbyname(3)  and
28                   related functions.
29
30       initgroups  Supplementary group access list,  used  by  getgrouplist(3)
31                   function.
32
33       netgroup    Network-wide  list  of  hosts  and  users,  used for access
34                   rules.  C libraries before glibc  2.1  supported  netgroups
35                   only over NIS.
36
37       networks    Network names and numbers, used by getnetent(3) and related
38                   functions.
39
40       passwd      User passwords, used by getpwent(3) and related functions.
41
42       protocols   Network protocols, used by getprotoent(3) and related func‐
43                   tions.
44
45       publickey   Public and secret keys for Secure_RPC used by NFS and NIS+.
46
47       rpc         Remote  procedure call names and numbers, used by getrpcby‐
48                   name(3) and related functions.
49
50       services    Network services, used by getservent(3) and  related  func‐
51                   tions.
52
53       shadow      Shadow  user  passwords,  used  by  getspnam(3) and related
54                   functions.
55
56       Here is an example /etc/nsswitch.conf file:
57
58           passwd:         compat
59           group:          compat
60           shadow:         compat
61
62           hosts:          dns [!UNAVAIL=return] files
63           networks:       nis [NOTFOUND=return] files
64           ethers:         nis [NOTFOUND=return] files
65           protocols:      nis [NOTFOUND=return] files
66           rpc:            nis [NOTFOUND=return] files
67           services:       nis [NOTFOUND=return] files
68
69       The first column is the database name.  The remaining columns specify:
70
71       *  One or more service specifications e.g., "files",  "db",  or  "nis".
72          The  order of the services on the line determines the order in which
73          those services will be queried, in turn, until a result is found.
74
75       *  Optional actions to perform if a particular result is obtained  from
76          the preceding service, e.g., "[NOTFOUND=return]".
77
78       The service specifications supported on your system depend on the pres‐
79       ence of shared libraries,  and  are  therefore  extensible.   Libraries
80       called  /lib/libnss_SERVICE.so.X  will provide the named SERVICE.  On a
81       standard installation, you can use "files", "db", "nis", and "nisplus".
82       For  the  hosts  database, you can additionally specify "dns".  For the
83       passwd, group, and shadow databases, you can additionally specify "com‐
84       pat" (see Compatibility mode below).  The version number X may be 1 for
85       glibc 2.0, or 2 for glibc 2.1 and later.  On  systems  with  additional
86       libraries  installed,  you  may have access to further services such as
87       "hesiod", "ldap", "winbind" and "wins".
88
89       An action may also be specified following a service specification.  The
90       action  modifies the behavior following a result obtained from the pre‐
91       ceding data source.  Action items take the general form:
92
93           [STATUS=ACTION]
94           [!STATUS=ACTION]
95
96       where
97
98           STATUS => success | notfound | unavail | tryagain
99           ACTION => return | continue
100
101       The ! negates the test, matching all possible results  except  the  one
102       specified.  The case of the keywords is not significant.
103
104       The  STATUS  value is matched against the result of the lookup function
105       called by the preceding service specification, and can be one of:
106
107           success     No error occurred and the requested entry is  returned.
108                       The default action for this condition is "return".
109
110           notfound    The  lookup  succeeded, but the requested entry was not
111                       found.  The default action for this condition is  "con‐
112                       tinue".
113
114           unavail     The  service is permanently unavailable.  This can mean
115                       either that the required file cannot be read,  or,  for
116                       network  services,  that the server is not available or
117                       does not allow queries.  The default  action  for  this
118                       condition is "continue".
119
120           tryagain    The  service  is  temporarily  unavailable.  This could
121                       mean a file is locked  or  a  server  currently  cannot
122                       accept  more  connections.  The default action for this
123                       condition is "continue".
124
125       The ACTION value can be one of:
126
127           return      Return a result now.  Do not call  any  further  lookup
128                       functions.  However, for compatibility reasons, if this
129                       is the selected action for the group database  and  the
130                       notfound  status,  and  the configuration file does not
131                       contain the initgroups line, the next  lookup  function
132                       is always called, without affecting the search result.
133
134           continue    Call the next lookup function.
135
136   Compatibility mode (compat)
137       The NSS "compat" service is similar to "files" except that it addition‐
138       ally permits special entries in /etc/passwd for granting users or  mem‐
139       bers  of  netgroups  access  to  the system.  The following entries are
140       valid in this mode:
141
142           +user       Include the specified user from the NIS passwd map.
143
144           +@netgroup  Include all users in the given netgroup.
145
146           -user       Exclude the specified user from the NIS passwd map.
147
148           -@netgroup  Exclude all users in the given netgroup.
149
150           +           Include every user, except  previously  excluded  ones,
151                       from the NIS passwd map.
152
153       By  default the source is "nis", but this may be overridden by specify‐
154       ing "nisplus" as the source  for  the  pseudo-databases  passwd_compat,
155       group_compat, and shadow_compat.
156

FILES

158       A service named SERVICE is implemented by a shared object library named
159       libnss_SERVICE.so.X that resides in /lib.
160
161           /etc/nsswitch.conf       NSS configuration file.
162           /lib/libnss_compat.so.X  implements "compat" source.
163           /lib/libnss_db.so.X      implements "db" source.
164           /lib/libnss_dns.so.X     implements "dns" source.
165           /lib/libnss_files.so.X   implements "files" source.
166           /lib/libnss_hesiod.so.X  implements "hesiod" source.
167           /lib/libnss_nis.so.X     implements "nis" source.
168           /lib/libnss_nisplus.so.X implements "nisplus" source.
169

NOTES

171       Within each process that uses nsswitch.conf, the entire  file  is  read
172       only  once.   If  the  file is later changed, the process will continue
173       using the old configuration.
174
175       Traditionally, there was only a single source for service  information,
176       often  in  the form of a single configuration file (e.g., /etc/passwd).
177       However, as other name services, such as the Network  Information  Ser‐
178       vice  (NIS) and the Domain Name Service (DNS), became popular, a method
179       was needed that would be more flexible than fixed search  orders  coded
180       into the C library.  The Name Service Switch mechanism, which was based
181       on the mechanism used by Sun Microsystems in the Solaris 2  C  library,
182       introduced a cleaner solution to the problem.
183

SEE ALSO

185       getent(1), nss(5)
186

COLOPHON

188       This  page  is  part of release 3.53 of the Linux man-pages project.  A
189       description of the project, and information about reporting  bugs,  can
190       be found at http://www.kernel.org/doc/man-pages/.
191
192
193
194Linux                             2013-02-12                  NSSWITCH.CONF(5)
Impressum