Langue: en

Autres versions - même langue

Version: Jul 2010 (fedora - 01/12/10)

Section: 5 (Format de fichier)


nslcd.conf - configuration file for LDAP nameservice daemon


The nss-pam-ldapd package allows LDAP directory servers to be used as a primary source of name service information. (Name service information typically includes users, hosts, groups, and other such data historically stored in flat files or NIS.)

The file nslcd.conf contains the configuration information for running nslcd (see nslcd(8)). The file contains options, one on each line, defining the way NSS lookups and PAM actions are mapped to LDAP lookups.



threads NUM
Specifies the number of threads to start that can handle requests and perform LDAP queries. The default is to start 5 threads.
uid UID
This specifies the user id with which the daemon should be run. This can be a numerical id or a symbolic value. If no uid is specified no attempt to change the user will be made. Note that you should use values that don't need LDAP to resolve.
gid GID
This specifies the group id with which the daemon should be run. This can be a numerical id or a symbolic value. If no gid is specified no attempt to change the group will be made. Note that you should use values that don't need LDAP to resolve.


uri URI
Specifies the LDAP URI of the server to connect to. The URI scheme may be ldap, ldapi or ldaps, specifying LDAP over TCP, ICP or SSL respectively (if supported by the LDAP library). Alternatively, the value DNS may be used to try to lookup the server using DNS SRV records.

When using the ldapi scheme, %2f should be used to escape slashes (e.g. ldapi://%2fvar%2frun%2fslapd%2fldapi/), although most of the time this should not be needed.

This option may be specified multiple times. Normally, only the first server will be used with the following servers as fall-back (see bind_timelimit below).

If LDAP lookups are used for host name resolution, any host names should be specified as an IP address or name that can be resolved without using LDAP.

ldap_version VERSION
Specifies the version of the LDAP protocol to use. The default is to use the maximum version supported by the LDAP library.
binddn DN
Specifies the distinguished name with which to bind to the directory server for lookups. The default is to bind anonymously.
Specifies the clear text credentials with which to bind. This option is only applicable when used with binddn above. If you set this option you should consider changing the permissions of the nslcd.conf file to only grant access to the root user.
rootpwmoddn DN
Specifies the distinguished name to use when the root user tries to modify a user's password using the PAM module. The PAM module prompts the user for the admin password instead of the user's password.


sasl_mech MECHANISM
Specifies the SASL mechanism to be used when performing SASL authentication.
sasl_realm REALM
Specifies the SASL realm to be used when performing SASL authentication.
sasl_authcid AUTHCID
Specifies the authentication identity to be used when performing SASL authentication.
sasl_authzid AUTHZID
Specifies the authorization identity to be used when performing SASL authentication. Must be specified in one of the formats: dn:<distinguished name> or u:<username>.
sasl_secprops PROPERTIES
Specifies Cyrus SASL security properties. Allowed values are described in the ldap.conf(5) manual page.


krb5_ccname NAME
Set the name for the GSS-API Kerberos credentials cache.


base [MAP] DN
Specifies the base distinguished name (DN) to use as search base. This option may be supplied multiple times and all specified bases will be searched.

A global search base may be specified or a MAP-specific one. If no MAP-specific search bases are defined the global ones are used.

If, instead of a DN, the value DOMAIN is specified, the host's DNS domain is used to construct a search base.

If this value is not defined an attempt is made to look it up in the configured LDAP server. Note that if the LDAP server is unavailable during start-up nslcd will not start.

scope [MAP] sub[tree]|one[level]|base
Specifies the search scope (subtree, one level or base object). The default scope is subtree; base scope is almost never useful for name service lookups.
deref never|searching|finding|always
Specifies the policy for dereferencing aliases. The default policy is to never dereference aliases.
referrals yes|no
Specifies whether automatic referral chasing should be enabled. The default behaviour is to chase referrals.
The FILTER is an LDAP search filter to use for a specific map. The default filter is a basic search on the objectClass for the map (e.g. (objectClass=posixAccount)).
This option allows for custom attributes to be looked up instead of the default RFC 2307 attributes. The MAP may be one of the supported maps below. The ATTRIBUTE is the one as used in RFC 2307 (e.g. userPassword, ipProtocolNumber or macAddress). The NEWATTRIBUTE may be any attribute as it is available in the directory.

If the NEWATTRIBUTE is presented in quotes (") it is treated as an expression which will be evaluated to build up the actual value used. See the section on attribute mapping expressions below for more details.

Only some attributes for passwd and shadow entries may be mapped with an expression (because other attributes may be used in search filters). For passwd entries the following attributes may be mapped with an expression: gidNumber, gecos, homeDirectory and loginShell. For shadow entries the following attributes may be mapped with an expression: shadowLastChange, shadowMin, shadowMax, shadowWarning, shadowInactive, shadowExpire and shadowFlag.


bind_timelimit SECONDS
Specifies the time limit (in seconds) to use when connecting to the directory server. This is distinct from the time limit specified in timelimit and affects the set-up of the connection only. Note that not all LDAP client libraries have support for setting the connection time out. The default bind_timelimit is 10 seconds.
timelimit SECONDS
Specifies the time limit (in seconds) to wait for a response from the LDAP server. A value of zero (0), which is the default, is to wait indefinitely for searches to be completed.
idle_timelimit SECONDS
Specifies the period if inactivity (in seconds) after which the connection to the LDAP server will be closed. The default is not to time out connections.
reconnect_sleeptime SECONDS
Specifies the number of seconds to sleep when connecting to all LDAP servers fails. By default 1 second is waited between the first failure and the first retry.
reconnect_retrytime SECONDS
Specifies the time after which the LDAP server is considered to be permanently unavailable. Once this time is reached retries will be done only once per this time period. The default value is 10 seconds.

Note that the reconnect logic as described above is the mechanism that is used between nslcd and the LDAP server. The mechanism between the NSS and PAM client libraries on one end and nslcd on the other is simpler with a fixed compiled-in time out of a 10 seconds for writing to nslcd and a time out of 60 seconds for reading answers. nslcd itself has a read time out of 0.5 seconds and a write time out of 60 seconds.


ssl on|off|start_tls
Specifies whether to use SSL/TLS or not (the default is not to). If start_tls is specified then StartTLS is used rather than raw LDAP over SSL. Not all LDAP client libraries support both SSL, StartTLS and all related configuration options.
tls_reqcert never|allow|try|demand|hard
Specifies what checks to perform on a server-supplied certificate. The meaning of the values is described in the ldap.conf(5) manual page. At least one of tls_cacertdir and tls_cacertfile is required if peer verification is enabled.
tls_cacertdir PATH
Specifies the directory containing X.509 certificates for peer authentication.
tls_cacertfile PATH
Specifies the path to the X.509 certificate for peer authentication.
tls_randfile PATH
Specifies the path to an entropy source.
tls_ciphers CIPHERS
Specifies the ciphers to use for TLS. See your TLS implementation's documentation for further information.
tls_cert PATH
Specifies the path to the file containing the local certificate for client TLS authentication.
tls_key PATH
Specifies the path to the file containing the private key for client TLS authentication.


pagesize NUMBER
Set this to a number greater than 0 to request paged results from the LDAP server in accordance with RFC2696. The default (0) is to not request paged results.

This is useful for LDAP servers that contain a lot of entries (e.g. more than 500) and limit the number of entries that are returned with one request. For OpenLDAP servers you may need to set sizelimit size.prtotal=unlimited for allowing more entries to be returned over multiple pages.

nss_initgroups_ignoreusers user1,user2,...
This option prevents group membership lookups through LDAP for the specified users. This can be useful in case of unavailability of the LDAP server. This option may be specified multiple times.

Alternatively, the value ALLLOCAL may be used. With that value nslcd builds a full list of non-LDAP users on startup.

pam_authz_search FILTER
This option allows flexible fine tuning of the authorisation check that should be performed. The search filter specified is executed and if any entries match, access is granted, otherwise access is denied.

The search filter can contain the following variable references: $username, $service, $ruser, $rhost, $tty, $hostname, $dn, and $uid. These references are substituted in the search filter using the same syntax as described in the section on attribute mapping expressions below.

For example, to check that the user has a proper authorizedService value if the attribute is present: (&(objectClass=posixAccount)(uid=$username) (|(authorizedService=$service)(!(authorizedService=*))))

The default behaviour is not to do this extra search and always grant access.


The following maps are supported. They are referenced as MAP in the options above.
Mail aliases. Note that most mail servers do not use the NSS interface for requesting mail aliases and parse /etc/aliases on their own.
Ethernet numbers (mac addresses).
Posix groups.
Host names.
Host and user groups used for access control.
Network numbers.
Posix users.
Protocol definitions (like in /etc/protocols).
Remote procedure call names and numbers.
Network service names and numbers.
Shadow user password information.


For some attributes a mapping expression may be used to construct the resulting value. This is currently only possible for attributes that do not need to be used in search filters.

The expressions are a subset of the double quoted string expressions in the Bourne (POSIX) shell. Instead of variable substitution, attribute lookups are done on the current entry and the attribute value is substituted. The following expressions are supported:

${attr} (or $attr for short)
will substitute the value of the attribute
(use default) will substitbute the value of the attribute or, if the attribute is not set or empty substitute the word
(use alternative) will substitbute word if attribute is set, otherwise substitute the empty string

The nslcd daemon checks the expressions to figure out which attributes to fetch from LDAP. Some examples to demonstrate how these expressions may be used in attribute mapping:

use the shadowFlag attribute, using the value 0 as default
use the uid attribute to build a homeDirectory value if that attribute is missing
if the isDisabled attribute is set, return 100, otherwise leave value empty


the main configuration file
Name Service Switch configuration file


nslcd(8), nsswitch.conf(5)


This manual was written by Arthur de Jong <arthur@arthurdejong.org> and is based on the nss_ldap(5) manual developed by PADL Software Pty Ltd.