Home

nsswitchconf

nsswitch.conf is the configuration file used by the Name Service Switch (NSS) in many Unix-like operating systems to determine where to obtain information for various system databases, such as user accounts, groups, and hostnames. The file is typically located at /etc/nsswitch.conf and is read by the C library during lookups performed by functions like getpwnam, getpwuid, getgrnam, gethostbyname, and related routines. The sources specified for each database determine the order and the providers consulted to resolve a query.

Format and syntax: Each non-comment line defines a database and a list of sources in decreasing order

Notes: Lines beginning with # are comments. The file is system-dependent, and supported databases or sources may

of
priority,
separated
by
spaces
after
a
colon.
For
example:
passwd:
files
ldap;
hosts:
files
dns.
The
order
matters:
the
first
source
that
can
answer
the
query
is
used.
Common
databases
include
passwd,
group,
shadow,
hosts,
networks,
services,
protocols,
rpc,
ethers,
and
netgroup.
Common
sources
include
files
(local
files
such
as
/etc/passwd
and
/etc/group),
dns,
nis,
nisplus,
ldap,
and
sss
(System
Security
Services
Daemon).
Some
implementations
provide
compat
mode
for
interoperability
with
legacy
/etc
files.
vary
between
Linux,
BSD,
and
other
Unix
variants.
Changes
to
nsswitch.conf
affect
NSS-based
lookups
and
do
not
automatically
restart
the
system;
individual
applications
may
implement
their
own
caching.