Jump to content

Name Service Switch

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 210.171.172.74 (talk) at 14:26, 27 May 2007 (+ja). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Name Service Switch (NSS) allows replacement of many Unix configuration files (e.g. /etc/passwd, /etc/group, /etc/hosts) with one or more centralized databases, with the mechanisms used to access those databases being configurable. (Earlier Unix-like systems, with the notable exception of Ultrix, either accessed only the configuration files or had the rules for which files or databases to access hardcoded; Ultrix offered nearly identical functionality to the Name Service Switch, with its configuration file being in /etc/svc.conf.) It was first developed by Sun Microsystems for their Solaris operating system, but has been subsequently ported to many other operating systems including FreeBSD, NetBSD, Linux, HP-UX, IRIX and AIX.

nsswitch.conf

NSS is usually configured using the file /etc/nsswitch.conf. This lists databases (e.g. group, passwd) and one or more sources for obtaining that information (e.g files for local files, nis for the Network Information Service, nisplus for NIS+, ldap for the Lightweight Directory Access Protocol, or mysql for the MySQL database service). For example:

passwd: files nis
group: files nis
hosts: files dns

The order of the services listed determines in which order NSS will attempt to use those service to resolve queries on the specified database.

NSS and the C library

NSS requires modifications to the C library so that calls to functions such as getpwent or getgrent will call into the appropriate NSS module. This means that existing applications that use these routines for identity information will not require any changes to work with NSS.

See also