Go to main content

man pages section 8: System Administration Commands

Exit Print View

Updated: Thursday, June 13, 2019
 
 

nscd(8)

Name

nscd - name service cache daemon

Synopsis

/usr/sbin/nscd [-f configuration-file] [-g] [-e cachename, yes
 | no] [-i cachename] [-C component(s)] [-D debuglevel] [-L log file]

Description

The nscd daemon is a process that provides a cache for most name service requests. The service properties of the svc:/system/name-service/cache SMF service determine the behavior of the cache daemon. See nscd.conf(5).

nscd provides caching for the passwd(5), group(5), hosts(5), ipnodes(5), exec_attr(5), prof_attr(5), user_attr(5), ethers(5), rpc(5), protocols(5), networks(5), bootparams(5), auth_attr(5), services(5), netmasks(5), project(5) databases through standard libc interfaces, such as gethostbyname(3C), getipnodebyname(3C), gethostbyaddr(3C), and others. The shadow file is specifically not cached. getspnam(3C) calls remain uncached as a result.

Each cache has a separate time-to-live for its data. By default, modifying the local database (/etc/hosts, /etc/passwd, and so forth) causes that cache to become invalidated upon the next call to nscd.

The updating and refreshing of any of the services that svc:/system/name-service/cache is optionally dependent upon (listed below) causes nscd to restart, which effectively clears all caches.

See nscd.conf(5).

nscd also acts as its own administration tool. If an instance of nscd is already running, commands are passed to the running version transparently.

When running with per-user lookups enabled (see nscd.conf(5)), nscd forks one and only one child process (that is, a per-user nscd ) on behalf of the user making the request. The per-user nscd will use the credentials of the user to open a per-user connection to the name repository configured for the per-user style of lookups. The lookup will be performed in the child process. The results are cached in the process and are available only to the same user. The caches are managed exactly the same as the main nscd daemon manages its own caches. Subsequent requests from the user will be handled by that per-user nscd until it terminates. The per-user nscd uses a configurable inactivity time-to-live (TTL) value and terminates itself after the inactivity TTL expires.

The maximum number of per-user nscds that can be created by the main nscd is configurable (see nscd.conf(5)). After the maximum number of them are created, the main nscd will use an LRU algorithm to terminate less active child nscds as needed.

The main nscd daemon creates, monitors, and manages all the child nscds. It creates a user's own nscd upon receiving the user's first per-user lookup. When the nscd daemon is started, if per-user lookups are enabled, it checks to ensure all conditions are met before getting ready to create a per-user nscd. When the daemon is stopped, it terminates all the per-user nscds under its control.

Per-user nscds use the same configuration as the main nscd. They read and use the same default configuration file or the one specified with the –f command line option. Once the configuration is read, the per-user nscd will use it for its entire lifetime.

Options

Several of the options described below require a cachename specification. Supported values for cachename are: passwd, group, hosts, ipnodes, exec_attr, prof_attr, user_attr, ethers, rpc, protocols, networks, bootparams, auth_attr, services, netmasks, printers, and project.

–f configuration-file

Causes nscd to read its configuration data from the specified file. This option is obsolete and will be removed in a future release.

–g

Prints current configuration and statistics to standard output. This is the only option executable by non-root users.

–e cachename, yes|no

Enables or disables the specified cache.

–i cachename

Invalidate the specified cache.

–C component(s)

Comma separated list of debug components to enable. The value all enables all components. All of the components are listed in the svc:/system/name-service/cache SMF service describe option.

–D debuglevel

Comma separated list of debug logging levels to enable. The value all enables all debug levels. All of the debug levels are listed in the svc:/system/name-service/cache SMF service describe option.

–L log file

Log file name to store debugging output.

Examples

Example 1 Stopping and Restarting the nscd Daemon.

example# svcadm disable system/name-service/cache

example# svcadm enable system/name-service/cache

Files

/etc/nscd.conf

Obsolete. Formerly determined the behavior of the cache daemon

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os

See Also

svcs(1), gethostbyname(3C), getipnodebyname(3C), getspnam(3C), auth_attr(5), bootparams(5), ethers(5), exec_attr(5), group(5), hosts(5), netmasks(5), networks(5), nscd.conf(5), nsswitch.conf(5), passwd(5), prof_attr(5), project(5), protocols(5), resolv.conf(5), rpc(5), services(5), user_attr(5), attributes(7), svcadm(8), ypbind(8)

Notes

The output from the –g option to nscd is subject to change. Do not rely upon it as a programming interface.

The nscd service is managed by the service management facility, smf(7), under the service identifier:

svc:/system/name-service/cache

Administrative actions on this service, such as enabling, disabling, or requesting restart, can be performed using svcadm(8). The service's status can be queried using the svcs(1) command.

The obsolete service svc:/system/name-service-cache has been retained for backwards compatibility with scripts that might reference it. Its only purpose is to serve as an optional_all dependency on the service svc:/system/name-service/cache. The obsolete service name will be removed in a future release.