Blame man5/nsswitch.conf.5

Packit 7cfc04
.\" Copyright (c) 1998, 1999 Thorsten Kukuk (kukuk@vt.uni-paderborn.de)
Packit 7cfc04
.\" Copyright (c) 2011, Mark R. Bannister <cambridge@users.sourceforge.net>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH NSSWITCH.CONF 5 2017-05-03 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
nsswitch.conf \- Name Service Switch configuration file
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The Name Service Switch (NSS) configuration file,
Packit 7cfc04
.IR /etc/nsswitch.conf ,
Packit 7cfc04
is used by the GNU C Library and certain other applications to determine
Packit 7cfc04
the sources from which to obtain name-service information in
Packit 7cfc04
a range of categories,
Packit 7cfc04
and in what order.
Packit 7cfc04
Each category of information is identified by a database name.
Packit 7cfc04
.PP
Packit 7cfc04
The file is plain ASCII text, with columns separated by spaces or tab
Packit 7cfc04
characters.
Packit 7cfc04
The first column specifies the database name.
Packit 7cfc04
The remaining columns describe the order of sources to query and a
Packit 7cfc04
limited set of actions that can be performed by lookup result.
Packit 7cfc04
.PP
Packit 7cfc04
The following databases are understood by the GNU C Library:
Packit 7cfc04
.TP 12
Packit 7cfc04
.B aliases
Packit 7cfc04
Mail aliases, used by
Packit 7cfc04
.BR getaliasent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B ethers
Packit 7cfc04
Ethernet numbers.
Packit 7cfc04
.TP
Packit 7cfc04
.B group
Packit 7cfc04
Groups of users, used by
Packit 7cfc04
.BR getgrent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B hosts
Packit 7cfc04
Host names and numbers, used by
Packit 7cfc04
.BR gethostbyname (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B initgroups
Packit 7cfc04
Supplementary group access list, used by
Packit 7cfc04
.BR getgrouplist (3)
Packit 7cfc04
function.
Packit 7cfc04
.TP
Packit 7cfc04
.B netgroup
Packit 7cfc04
Network-wide list of hosts and users, used for access rules.
Packit 7cfc04
C libraries before glibc 2.1 supported netgroups only over NIS.
Packit 7cfc04
.TP
Packit 7cfc04
.B networks
Packit 7cfc04
Network names and numbers, used by
Packit 7cfc04
.BR getnetent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B passwd
Packit 7cfc04
User passwords, used by
Packit 7cfc04
.BR getpwent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B protocols
Packit 7cfc04
Network protocols, used by
Packit 7cfc04
.BR getprotoent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B publickey
Packit 7cfc04
Public and secret keys for Secure_RPC used by NFS and NIS+.
Packit 7cfc04
.TP
Packit 7cfc04
.B rpc
Packit 7cfc04
Remote procedure call names and numbers, used by
Packit 7cfc04
.BR getrpcbyname (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B services
Packit 7cfc04
Network services, used by
Packit 7cfc04
.BR getservent (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.TP
Packit 7cfc04
.B shadow
Packit 7cfc04
Shadow user passwords, used by
Packit 7cfc04
.BR getspnam (3)
Packit 7cfc04
and related functions.
Packit 7cfc04
.PP
Packit 7cfc04
The GNU C Library ignores databases with unknown names.  Some
Packit 7cfc04
applications use this to implement special handling for their own
Packit 7cfc04
databases.  For example,
Packit 7cfc04
.BR sudo (8)
Packit 7cfc04
consults the
Packit 7cfc04
.B sudoers
Packit 7cfc04
database.
Packit 7cfc04
.PP
Packit 7cfc04
Here is an example
Packit 7cfc04
.I /etc/nsswitch.conf
Packit 7cfc04
file:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
passwd:         compat
Packit 7cfc04
group:          compat
Packit 7cfc04
shadow:         compat
Packit 7cfc04
Packit 7cfc04
hosts:          dns [!UNAVAIL=return] files
Packit 7cfc04
networks:       nis [NOTFOUND=return] files
Packit 7cfc04
ethers:         nis [NOTFOUND=return] files
Packit 7cfc04
protocols:      nis [NOTFOUND=return] files
Packit 7cfc04
rpc:            nis [NOTFOUND=return] files
Packit 7cfc04
services:       nis [NOTFOUND=return] files
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
The first column is the database name.
Packit 7cfc04
The remaining columns specify:
Packit 7cfc04
.IP * 3
Packit 7cfc04
One or more service specifications, for example, "files", "db", or "nis".
Packit 7cfc04
The order of the services on the line determines the order in which
Packit 7cfc04
those services will be queried, in turn, until a result is found.
Packit 7cfc04
.IP *
Packit 7cfc04
Optional actions to perform if a particular result is obtained
Packit 7cfc04
from the preceding service, for example, "[NOTFOUND=return]".
Packit 7cfc04
.PP
Packit 7cfc04
The service specifications supported on your system depend on the
Packit 7cfc04
presence of shared libraries, and are therefore extensible.
Packit 7cfc04
Libraries called
Packit 7cfc04
.IB /lib/libnss_SERVICE.so. X
Packit 7cfc04
will provide the named
Packit 7cfc04
.IR SERVICE .
Packit 7cfc04
On a standard installation, you can use
Packit 7cfc04
"files", "db", "nis", and "nisplus".
Packit 7cfc04
For the
Packit 7cfc04
.B hosts
Packit 7cfc04
database, you can additionally specify "dns".
Packit 7cfc04
For the
Packit 7cfc04
.BR passwd ,
Packit 7cfc04
.BR group ,
Packit 7cfc04
and
Packit 7cfc04
.BR shadow
Packit 7cfc04
databases, you can additionally specify
Packit 7cfc04
"compat" (see
Packit 7cfc04
.B "Compatibility mode"
Packit 7cfc04
below).
Packit 7cfc04
The version number
Packit 7cfc04
.B X
Packit 7cfc04
may be 1 for glibc 2.0, or 2 for glibc 2.1 and later.
Packit 7cfc04
On systems with additional libraries installed, you may have access to
Packit 7cfc04
further services such as "hesiod", "ldap", "winbind" and "wins".
Packit 7cfc04
.PP
Packit Service 3886f2
If System Security Services Daemon (SSSD)
Packit Service 3886f2
is installed on your system, you can use
Packit Service 3886f2
this service with the "sss" keyword.
Packit Service 3886f2
SSSD supports the following databases:
Packit Service 3886f2
.BR passwd ,
Packit Service 3886f2
.BR group ,
Packit Service 3886f2
.BR services
Packit Service 3886f2
and
Packit Service 3886f2
.BR netgroup .
Packit Service 3886f2
.PP
Packit 7cfc04
An action may also be specified following a service specification.
Packit 7cfc04
The action modifies the behavior following a result obtained
Packit 7cfc04
from the preceding data source.
Packit 7cfc04
Action items take the general form:
Packit 7cfc04
.PP
Packit 7cfc04
.RS 4
Packit 7cfc04
.RI [ STATUS = ACTION ]
Packit 7cfc04
.br
Packit 7cfc04
.RI [! STATUS = ACTION ]
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
where
Packit 7cfc04
.PP
Packit 7cfc04
.RS 4
Packit 7cfc04
.I STATUS
Packit 7cfc04
=>
Packit 7cfc04
.B success
Packit 7cfc04
|
Packit 7cfc04
.B notfound
Packit 7cfc04
|
Packit 7cfc04
.B unavail
Packit 7cfc04
|
Packit 7cfc04
.B tryagain
Packit 7cfc04
.br
Packit 7cfc04
.I ACTION
Packit 7cfc04
=>
Packit 7cfc04
.B return
Packit 7cfc04
|
Packit 7cfc04
.B continue
Packit 7cfc04
|
Packit 7cfc04
.B merge
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
The ! negates the test, matching all possible results except the
Packit 7cfc04
one specified.
Packit 7cfc04
The case of the keywords is not significant.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I STATUS
Packit 7cfc04
value is matched against the result of the lookup function called by
Packit 7cfc04
the preceding service specification, and can be one of:
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 12
Packit 7cfc04
.B success
Packit 7cfc04
No error occurred and the requested entry is returned.
Packit 7cfc04
The default action for this condition is "return".
Packit 7cfc04
.TP
Packit 7cfc04
.B notfound
Packit 7cfc04
The lookup succeeded, but the requested entry was not found.
Packit 7cfc04
The default action for this condition is "continue".
Packit 7cfc04
.TP
Packit 7cfc04
.B unavail
Packit 7cfc04
The service is permanently unavailable.
Packit 7cfc04
This can mean either that the
Packit 7cfc04
required file cannot be read, or, for network services, that the server
Packit 7cfc04
is not available or does not allow queries.
Packit 7cfc04
The default action for this condition is "continue".
Packit 7cfc04
.TP
Packit 7cfc04
.B tryagain
Packit 7cfc04
The service is temporarily unavailable.
Packit 7cfc04
This could mean a file is
Packit 7cfc04
locked or a server currently cannot accept more connections.
Packit 7cfc04
The default action for this condition is "continue".
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I ACTION
Packit 7cfc04
value can be one of:
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 12
Packit 7cfc04
.B return
Packit 7cfc04
Return a result now.
Packit 7cfc04
Do not call any further lookup functions.
Packit 7cfc04
However, for compatibility reasons, if this is the selected action for the
Packit 7cfc04
.B group
Packit 7cfc04
database and the
Packit 7cfc04
.B notfound
Packit 7cfc04
status, and the configuration file does not contain the
Packit 7cfc04
.B initgroups
Packit 7cfc04
line, the next lookup function is always called,
Packit 7cfc04
without affecting the search result.
Packit 7cfc04
.TP
Packit 7cfc04
.B continue
Packit 7cfc04
Call the next lookup function.
Packit 7cfc04
.TP
Packit 7cfc04
.B merge
Packit 7cfc04
.I [SUCCESS=merge]
Packit 7cfc04
is used between two database entries.
Packit 7cfc04
When a group is located in the first of the two group entries,
Packit 7cfc04
processing will continue on to the next one.
Packit 7cfc04
If the group is also found in the next entry (and the group name and GID
Packit 7cfc04
are an exact match), the member list of the second entry will be added
Packit 7cfc04
to the group object to be returned.
Packit 7cfc04
Available since glibc 2.24.
Packit 7cfc04
Note that merging will not be done for
Packit 7cfc04
.BR getgrent (3)
Packit 7cfc04
nor will duplicate members be pruned when they occur in both entries
Packit 7cfc04
being merged.
Packit 7cfc04
.RE
Packit 7cfc04
.SS Compatibility mode (compat)
Packit 7cfc04
The NSS "compat" service is similar to "files" except that it
Packit 7cfc04
additionally permits special entries in corresponding files
Packit 7cfc04
for granting users or members of netgroups access to the system.
Packit 7cfc04
The following entries are valid in this mode:
Packit 7cfc04
.RS 4
Packit 7cfc04
.PP
Packit 7cfc04
For
Packit 7cfc04
.B passwd
Packit 7cfc04
and
Packit 7cfc04
.B shadow
Packit 7cfc04
databases:
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 12
Packit 7cfc04
.BI + user
Packit 7cfc04
Include the specified
Packit 7cfc04
.I user
Packit 7cfc04
from the NIS passwd/shadow map.
Packit 7cfc04
.TP
Packit 7cfc04
.BI +@ netgroup
Packit 7cfc04
Include all users in the given
Packit 7cfc04
.IR netgroup .
Packit 7cfc04
.TP
Packit 7cfc04
.BI \- user
Packit 7cfc04
Exclude the specified
Packit 7cfc04
.I user
Packit 7cfc04
from the NIS passwd/shadow map.
Packit 7cfc04
.TP
Packit 7cfc04
.BI \-@ netgroup
Packit 7cfc04
Exclude all users in the given
Packit 7cfc04
.IR netgroup .
Packit 7cfc04
.TP
Packit 7cfc04
.B +
Packit 7cfc04
Include every user, except previously excluded ones, from the
Packit 7cfc04
NIS passwd/shadow map.
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
For
Packit 7cfc04
.B group
Packit 7cfc04
database:
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 12
Packit 7cfc04
.BI + group
Packit 7cfc04
Include the specified
Packit 7cfc04
.I group
Packit 7cfc04
from the NIS group map.
Packit 7cfc04
.TP
Packit 7cfc04
.BI \- group
Packit 7cfc04
Exclude the specified
Packit 7cfc04
.I group
Packit 7cfc04
from the NIS group map.
Packit 7cfc04
.TP
Packit 7cfc04
.B +
Packit 7cfc04
Include every group, except previously excluded ones, from the
Packit 7cfc04
NIS group map.
Packit 7cfc04
.RE
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
By default, the source is "nis", but this may be
Packit 7cfc04
overridden by specifying any NSS service except "compat" itself
Packit 7cfc04
as the source for the pseudo-databases
Packit 7cfc04
.BR passwd_compat ,
Packit 7cfc04
.BR group_compat ,
Packit 7cfc04
and
Packit 7cfc04
.BR shadow_compat .
Packit Service 3886f2
.PP
Packit Service 3886f2
If SSSD is installed on your system, you can use "sss" as the source
Packit Service 3886f2
for these pseudo-databases.
Packit 7cfc04
.SH FILES
Packit 7cfc04
A service named
Packit 7cfc04
.I SERVICE
Packit 7cfc04
is implemented by a shared object library named
Packit 7cfc04
.IB libnss_SERVICE.so. X
Packit 7cfc04
that resides in
Packit 7cfc04
.IR /lib .
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 25
Packit 7cfc04
.PD 0
Packit 7cfc04
.I /etc/nsswitch.conf
Packit 7cfc04
NSS configuration file.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_compat.so. X
Packit 7cfc04
implements "compat" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_db.so. X
Packit 7cfc04
implements "db" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_dns.so. X
Packit 7cfc04
implements "dns" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_files.so. X
Packit 7cfc04
implements "files" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_hesiod.so. X
Packit 7cfc04
implements "hesiod" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_nis.so. X
Packit 7cfc04
implements "nis" source.
Packit 7cfc04
.TP
Packit 7cfc04
.IB /lib/libnss_nisplus.so. X
Packit 7cfc04
implements "nisplus" source.
Packit 7cfc04
.PD
Packit 7cfc04
.RE
Packit 7cfc04
.PP
Packit 7cfc04
The following files are read when "files" source is specified
Packit 7cfc04
for respective databases:
Packit 7cfc04
.RS 4
Packit 7cfc04
.TP 12
Packit 7cfc04
.PD 0
Packit 7cfc04
.B aliases
Packit 7cfc04
.I /etc/aliases
Packit 7cfc04
.TP
Packit 7cfc04
.B ethers
Packit 7cfc04
.I /etc/ethers
Packit 7cfc04
.TP
Packit 7cfc04
.B group
Packit 7cfc04
.I /etc/group
Packit 7cfc04
.TP
Packit 7cfc04
.B hosts
Packit 7cfc04
.I /etc/hosts
Packit 7cfc04
.TP
Packit 7cfc04
.B initgroups
Packit 7cfc04
.I /etc/group
Packit 7cfc04
.TP
Packit 7cfc04
.B netgroup
Packit 7cfc04
.I /etc/netgroup
Packit 7cfc04
.TP
Packit 7cfc04
.B networks
Packit 7cfc04
.I /etc/networks
Packit 7cfc04
.TP
Packit 7cfc04
.B passwd
Packit 7cfc04
.I /etc/passwd
Packit 7cfc04
.TP
Packit 7cfc04
.B protocols
Packit 7cfc04
.I /etc/protocols
Packit 7cfc04
.TP
Packit 7cfc04
.B publickey
Packit 7cfc04
.I /etc/publickey
Packit 7cfc04
.TP
Packit 7cfc04
.B rpc
Packit 7cfc04
.I /etc/rpc
Packit 7cfc04
.TP
Packit 7cfc04
.B services
Packit 7cfc04
.I /etc/services
Packit 7cfc04
.TP
Packit 7cfc04
.B shadow
Packit 7cfc04
.I /etc/shadow
Packit 7cfc04
.PD
Packit 7cfc04
.RE
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Within each process that uses
Packit 7cfc04
.BR nsswitch.conf ,
Packit 7cfc04
the entire file is read only once.
Packit 7cfc04
If the file is later changed, the
Packit 7cfc04
process will continue using the old configuration.
Packit 7cfc04
.PP
Packit 7cfc04
Traditionally, there was only a single source for service information,
Packit 7cfc04
often in the form of a single configuration
Packit 7cfc04
file (e.g., \fI/etc/passwd\fP).
Packit 7cfc04
However, as other name services, such as the Network Information
Packit 7cfc04
Service (NIS) and the Domain Name Service (DNS), became popular,
Packit 7cfc04
a method was needed
Packit 7cfc04
that would be more flexible than fixed search orders coded into
Packit 7cfc04
the C library.
Packit 7cfc04
The Name Service Switch mechanism,
Packit 7cfc04
which was based on the mechanism used by
Packit 7cfc04
Sun Microsystems in the Solaris 2 C library,
Packit 7cfc04
introduced a cleaner solution to the problem.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR getent (1),
Packit 7cfc04
.BR nss (5)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.