Name Service Switch

From Wikipedia, the free encyclopedia

Jump to: navigation, search

In Unix-like operating systems, the Name Service Switch (NSS) allows Unix configuration databases to be provided by different sources, including local files (for example: /etc/passwd, /etc/group, /etc/hosts), LDAP, and other sources.

Contents

[edit] nsswitch.conf

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

passwd: files ldap
shadow: files ldap
group: files ldap
hosts: files ldap

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

[edit] NSS and the C library

NSS is implemented within the C library, so that calls to functions such as getpwent or getgrent will call into the appropriate NSS module. Making the modifications at the library level means that existing applications that use these routines for identity information do not require any changes to work with NSS.

[edit] History

Earlier Unix-like systems, with the notable exception of Ultrix, either accessed only the configuration files or had hard-coded rules for files or databases to access; Ultrix offered nearly identical functionality to the Name Service Switch, using the configuration file /etc/svc.conf.

Sun Microsystems first developed NSS for their Solaris operating system, but subsequently programmers ported it to many other operating systems including FreeBSD, NetBSD, GNU/Linux, HP-UX, IRIX and AIX.

[edit] See also

[edit] External links