nsswitch.conf - configuration file for the name service switch
The operating system uses a number of databases of information about hosts, ipnodes, users (passwd(5), shadow(5), and user_attr(5)), and groups. Data for these can come from a variety of sources: hostnames and host addresses, for example, can be found in /etc/hosts, NIS, LDAP, DNS, or Multicast DNS. Zero or more sources can be used for each database; the sources and their lookup order are specified in svc:/system/name-service/switch service. For the purposes of backwards compatibility, the /etc/nsswitch.conf file is regenerated from the SMF properties configured in the svc:/system/name-service/switch service. The /etc/nsswitch.conf file is considered obsolete.
The following databases use the switch file:
The following sources can be used:
/etc/inet/ipnodes is a symbolic link to /etc/hosts.
The config property group of the svc:/system/name-service/switch service contains the configuration for the nsswitch.conf file.
The config/default property sets the default property for all nsswitch databases, while the other properties can be used to override the default property if desired.
config/default set to "files", and config/host set to "files dns" defaults all databases to local files database access, except for the host database which will search files first and dns second, if dns access is configured.
The following single-valued properties are supported:
config/default Default db configuration config/host Override for host db config/password Override for passwd db config/group Override for group db config/network Override for network db config/protocol Override for protocol db config/rpc Override for rpc db config/ether Override for ether db config/netmask Override for netmask db config/bootparam Override for bootparam db config/publickey Override for publickey db config/netgroup Override for netgroup db config/automount Override for automount db config/alias Override for alias db config/service Override for service db config/project Override for project db config/auth_attr Override for auth_attr db config/prof_attr Override for prof_attr db config/sudoer Override for sudoers db config/tnrhtp Override for tnrhtp db config/tnrhdb Override for tnrhdb db
Typically the property values are simple, such as "files" "files nis". However, when multiple sources are specified, it is sometimes necessary to define precisely the circumstances under which each source is tried. A source can return one of the following codes:
For each status code, two actions are possible:
Additionally, for TRYAGAIN only, the following actions are possible:
The complete syntax of an entry is:
<entry> ::= <database> ":" [<source> [<criteria>]]* <criteria> ::= "[" <criterion>+ "]" <criterion> ::= <status> "=" <action> <status> ::= "success" | "notfound" | "unavail" | "tryagain"
For every status except TRYAGAIN, the action syntax is:
<action> ::= "return" | "continue"
For the TRYAGAIN status, the action syntax is:
<action> ::= "return" | "continue" | "forever" | <n> <n> ::= 0...MAX_INT
Each property is a single valued string. The <source> names are case-sensitive, but <action> and <status> names are case-insensitive.
If a database entry or default is absent, the system defaults to "files" in all situations. Additionally if the name service cache service (svc:/system/name-service/cache) is not enabled, all attempts to access remote file services may fail or return incomplete results.
The default criteria for DNS and the NIS server in “DNS-forwarding mode” is [SUCCESS=return NOTFOUND=continue UNAVAIL=continue TRYAGAIN=3].
The default criteria for all other sources is [SUCCESS=return NOTFOUND=continue UNAVAIL=continue TRYAGAIN=forever].
The default, or explicitly specified, criteria are meaningless following the last source in an entry; and they are ignored, since the action is always to return to the caller irrespective of the status code the source returns.
In order to ensure that they all return consistent results, gethostbyname(3C), getaddrinfo(3C), getservbyname(3C), and netdir_getbyname(3C) functions are all implemented in terms of the same internal library function. This function obtains the system-wide source lookup policy for hosts , ipnodes, and services based on the inet family entries in netconfig(5) and uses the switch entries only if the netconfig entries have a - (hyphen) in the last column for nametoaddr libraries. See the Notes section in gethostbyname(3C) and getservbyname(3C) for details.
The NIS (YP) server can be run in DNS-forwarding mode, where it forwards lookup requests to DNS for host-names and -addresses that do not exist in its database. In this case, specifying nis as a source for hosts is sufficient to get DNS lookups; dns need not be specified explicitly as a source.
When password aging is turned on, only a limited set of possible name services are supported and must follow those rules:
passwd line must have 1, 2 or 3 entries
First passwd entry must be files
passwd entries other than files, nis and ldap are ignored and skipped during password update. (It is necessary to use source-specific tool to update password in such database).
Any other settings causes the passwd(1) command to fail when it attempts to change the password after expiration and prevents the user from logging in. These are the only permitted settings when password aging has been turned on. Otherwise, you can work around incorrect passwd: lines by using the -r repository argument to the passwd(1) command and using passwd -r repository to override the nsswitch.conf settings and specify in which name service you want to modify your password.
The compiled-in default entries for all databases is "files".
The files source for the ipnodes and hosts databases is identical, as /etc/inet/ipnodes is a symbolic link to /etc/hosts. The host property is used for host lookups.
When using Active Directory, dns is required to perform hosts resolution.
It's strongly advised that dns always be used to perform host lookups. This is especially true when ldap is being used for name service lookups. The use of ldap for host lookups is not recommended. Adding ldap to hosts will likely prevent authentication to the LDAP server while using TLS. In order to get information from the Internet Domain Name Service for hosts use the following configuration and set up the /etc/resolv.conf file (see resolv.conf(5) for more details):
Many of the databases have enumeration functions: passwd has getpwent(), hosts has gethostent(), and so on. These were reasonable when the only source was files but often make little sense for hierarchically structured sources that contain large numbers of entries, much less for multiple sources. The interfaces are still provided and the implementations strive to provide reasonable results, but the data returned can be incomplete (enumeration for hosts is simply not supported by the dns source), inconsistent (if multiple sources are used), formatted in an unexpected fashion (for a host with a canonical name and three aliases, a source might return four hostents, and they might not be consecutive), or very expensive (enumerating a passwd database of 5,000 users is probably a bad idea). Furthermore, multiple threads in the same process using the same reentrant enumeration function (getXXXent_r() are supported beginning with SunOS 5.3) share the same enumeration position; if they interleave calls, they enumerate disjoint subsets of the same database.
In general, the use of the enumeration functions is deprecated. In the case of passwd, shadow, and group, it might sometimes be appropriate to use fgetgrent(), fgetpwent(), and fgetspent() (see getgrnam(3C), getpwnam(3C), and getspnam(3C), respectively), which use only the files source.
A source named SSS is implemented by a shared object named nss_SSS.so.1 that resides in /usr/lib.
Configuration file. (Obsolete.)
Implements dns source.
Implements files source.
Implements mdns source.
Implements nis source.
Implements ldap source.
Implements ad source.
Configuration file for netdir(3C) functions that redirects hosts/devices policy to the switch.
Sample configuration file that uses files only.
Sample configuration file that uses files and nis.
Sample configuration file that uses files and ldap.
Sample configuration file that uses files and ad.
Sample configuration file that uses files, dns and mdns (dns and mdns only for hosts).
kpasswd(1), newtask(1), passwd(1), ethers(3C), getaddrinfo(3C), getauthnam(3C), getexecprof(3C), getgrnam(3C), gethostbyname(3C), getnetbyname(3C), getnetgrent(3C), getprofnam(3C), getprotobyname(3C), getpublickey(3C), getpwnam(3C), getrpcbyname(3C), getservbyname(3C), getspnam(3C), getuserattr(3C), getusernam(3C), netdir(3C), secure_rpc(3C), getdefaultproj(3PROJECT), getprojent(3PROJECT), inproj(3PROJECT), setproject(3PROJECT), auth_attr(5), hosts(5), netconfig(5), project(5), resolv.conf(5), user_attr(5), ypfiles(5), ad(7), ldap(7), pam_list(7), automount(8), ifconfig(8), mdnsd(8), nscfg(8), rpc.bootparamd(8), sendmail(8)
Within each process that uses nsswitch.conf, the entire file is read only once; if the file is later changed, the process continues using the old configuration.
The use of both nis and ldap as sources for the same database is strongly discouraged since both the name services are expected to store similar information and the lookups on the database can yield different results depending on which name service is operational at the time of the request.
Do not use the ldap and ad keywords together when the Oracle Solaris LDAP client uses schema mapping to talk to Active Directory.
Misspelled names of sources and databases are treated as legitimate names of (most likely non-existent) sources and databases.
The compat backend and the use of '+' or '-' interactions in the password and group files is no longer supported.
nsswitch.conf does not control the name service configuration for everything in Oracle Solaris.