---
name: "pam_ldap.conf"
section: "5"
platform: "linux"
package: "libpam-ldap"
version: "186-4+b1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/pam_ldap/5"
---

# pam\_ldap.conf(5)

LDAP pluggable authentication module

Part of [pam\_ldap(5)](/pam_ldap/5.md).

## NAME

pam\_ldap - LDAP pluggable authentication module

## DESCRIPTION

The **pam\_ldap** module is a Pluggable Authentication Module (PAM) which provides for authentication, authorization and password changing against *LDAP* servers.

Features of the PADL pam\_ldap module include support for transport layer security, SASL authentication, directory server-enforced password policy, and host- and group- based logon authorization.

The present version of **pam\_ldap** supports AIX 5L, FreeBSD 3.x and above, HP-UX 11i, IRIX 6.x, Linux, Mac OS X 10.2 and above, and Solaris 2.6 and above. Many vendors provide their own LDAP authentication providers, often also called pam\_ldap. This manual page applies to the PADL **pam\_ldap** module only. If you are using a vendor provided module, consult the relevant documentation instead.

When authenticating or authorizing a user, **pam\_ldap** first maps the user's login name to a distinguished name by searching the directory server. This must be possible using the local system's identity, specified in pam\_ldap.conf. (Note that presently only simple authentication is supported for authenticating in this initial step.)

To authenticate a user, **pam\_ldap** attempts to bind to the directory server using the distinguished name of the user (retrieved previously). Both simple and SASL authentication mechanisms are supported; in the former case, one should take care to use transport security to prevent the user's password being transmitted in the clear.

A variety of authorization primitives are supported by **pam\_ldap,** discussed in the configuration section below.

Finally, **pam\_ldap** supports a number of password change protocols used by directory servers from various vendors. (Some directory servers support more than one password change protocol.)

Whilst **pam\_ldap** is generally configured in the system LDAP naming configuration file (pam\_ldap.conf), some options can be configured in the PAM configuration file, to allow for per-service granularity. These options include the path to the LDAP naming configuration file to use, so in effect all options can be configured on a per-service basis. Options are listed below under PAM Configuration.

## CONFIGURATION

**pam\_ldap** stores its configuration in the **pam\_ldap.conf** file. (It should be noted that some LDAP client libraries, such as OpenLDAP, also use a configuration file of the same name. **pam\_ldap** supports many of the same configuration file options as OpenLDAP, but it adds several that are specific to the functionality it provides. It is not guaranteed that **pam\_ldap** will continue to match the configuration file semantics of OpenLDAP. You may wish to use different files.)

Configuration file options consist of a keyword followed by a space and any arguments. The following options are supported by both **pam\_ldap** and the PADL **nss\_ldap** module:

- **host \<name:port ...\>**

  **Specifies the name(s) or IP address(es) of the** *LDAP* server(s) to connect to. In the case that **nss\_ldap** is used for host name resolution, each server should be specified as an IP address or name that can be resolved without using *LDAP.* Multiple servers may be specified, each separated by a space. The failover time depends on whether the *LDAP* client library supports configurable network or connect timeouts (see **bind\_timelimit** below).

- **base \<base\>**

  Specifies the default base distinguished name (DN) to use for searches.

- **uri \<ldap\[is\]://\[name\[:port\]\] ...\>**

  For *LDAP* client libraries that support it, specifies the URI(s) of the LDAP server(s) to connect to. The URI scheme may be **ldap,** **ldapi,** or **ldaps,** specifying LDAP over TCP, IPC and SSL respectively. If applicable, a port number can be specified; the default port number for the selected protocol is used if omitted. This option takes precedence over the **host** option; it is not possible to combine the two.

- **ldap\_version \<version\>**

  Specifies the version of the *LDAP* protocol to use. Presently **version** must be 2 or 3. The default is to use the maximum version supported by the client library.

- **binddn \<binddn\>**

  Specifies the distinguished name with which to bind to the directory server(s). This option is optional; the default is to bind anonymously.

- **bindpw \<bindpw\>**

  Specifies the cleartext credentials with which to bind. This option is only applicable when used with **binddn** above. The default is no credential (anonymous bind). When binding to the directory using *SASL* or other authentication mechanisms apart from simple binds, this option is not used.

- **rootbinddn \<binddn\>**

  This option has the same syntax and effect as the **binddn** option above, except it applies when the effective user ID is zero. If not specified, then the identity specified in **binddn** is used instead. Because the configuration file may be readable by many users, the root bind DN credentials are stored in the **pam\_ldap.secret** file instead. This file is usually in the same directory as the configuration file.

- **port \<port\>**

  Specifies the port to connect to; this option is used with the **host** option, and is ignored with the **uri** option.

- **scope \<sub\|one\|base\>**

  Specifies the search scope (subtree, one level or base object). The default scope is subtree; base scope is almost never useful for nameservice lookups.

- **deref \<never\|searching\|finding\|always\>**

  Specifies the policy for dereferencing aliases. The default policy is to never dereference aliases.

- **timelimit \<timelimit\>**

  Specifies the time limit (in seconds) to use when performing searches. A value of zero (0), which is the default, is to wait indefinitely for searches to be completed.

- **bind\_timelimit \<timelimit\>**

  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 initial server connection only. (Server connections are otherwise cached.) Only some *LDAP* client libraries have the underlying functionality necessary to support this option. The default bind timelimit is 30 seconds.

- **referrals \<yes\|no\>**

  Specifies whether automatic referral chasing should be enabled. The default behaviour is specified by the *LDAP* client library.

- **restart \<yes\|no\>**

  Specifies whether the *LDAP* client library should restart the [select(2)](/select/2.md) system call when interrupted. This feature is not supported by all client libraries.

- **logdir \<directory\>**

  Specifies the directory used for logging by the *LDAP* client library. This feature is not supported by all client libraries.

- **debug \<level\>**

  Specifies the debug level used for logging by the *LDAP* client library. This feature is not supported by all client libraries, and does not apply to the **nss\_ldap** and **pam\_ldap** modules themselves (debugging, if any, is configured separately and usually at compile time).

- **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 and StartTLS, and all related configuration options.

- **sslpath \<cert7\_path\>**

  For the Netscape and Mozilla *LDAP* client libraries only, this specifies the path to the X.509 certificate database.

- **tls\_checkpeer \<yes\|no\>**

  Specifies whether to require and verify the server certificate or not, when using SSL/TLS with the OpenLDAP client library. The default is to use the default behaviour of the client library; for OpenLDAP 2.0 and earlier it is "no", for OpenLDAP 2.1 and later it is "yes". At least one of **tls\_cacertdir** and **tls\_cacertfile** is required if peer verification is enabled.

- **tls\_cacertdir \<certificate\_dir\>**

  Specifies the directory containing X.509 certificates for peer authentication.

- **tls\_cacertfile \<certificate\_file\>**

  Specifies the path to the X.509 certificate for peer authentication.

- **tls\_randfile \<entropy\_file\>**

  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 \<certificate\_file\>**

  Specifies the path to the file containing the local certificate for client TLS authentication.

- **tls\_key \<key\_file\>**

  Specifies the path to the file containing the private key for client TLS authentication.

- The following configuration options apply to pam\_ldap only:

  - **pam\_login\_attribute \<attribute\>**

  Specifies the attribute to use when constructing the attribute value assertion for retrieving a directory entry for a user's login name. The default is "uid", for compatibility with RFC 2307.

- **pam\_filter \<filter\>**

  Specifies a filter to use when retrieving user information. The user entry must match the attribute value assertion of (pam\_login\_attribute=login\_name) as well as any filter specified here. There is no default for this option.

- **pam\_lookup\_policy \<yes\|no\>**

  Specifies whether to search the root DSE for password policy. The  default is "no".

- **pam\_check\_host\_attr \<yes\|no\>**

  Specifies whether the "host" attribute should be checked for logon authorization ("account" in the PAM stack). The default is not to. If set to "yes" and a user has no value for the "host" attribute, then the user will be unable to login.

- **pam\_check\_service\_attr \<yes\|no\>**

  Specifies whether the "authorizedService" attribute should be checked for logon authorization ("account" in the PAM stack). The default is not to. If set to "yes" and a user has no value for the "authorizedService" attribute, then the user will be unable to login.

- **pam\_groupdn \<groupdn\>**

  Specifies the distinguished name of a group to which a user must belong for logon authorization to succeed. **pam\_member\_attribute \<attribute\>** Specifies the attribute to use when testing a user's membership of a  group specified in the **pam\_groupdn** option.

- **pam\_min\_uid \<uid\>**

  If specified, a user must have a POSIX user ID of at least **uid** in order for logon authorization to succeed.

- **pam\_max\_uid \<uid\>**

  If specified, a user must have a POSIX user ID of no greater than **uid** in order for logon authorization to succeed.

- **pam\_template\_login\_attribute \<attribute\>**

  When using template users (not supported by all PAM applications), specifies the attribute containing the user's actual login name. The **pam\_ldap** module will set PAM\_USER to the value of this attribute if present in the user's entry, otherwise it defaults to the user specified in the **pam\_template\_login** option.

- **pam\_template\_login \<user\>**

  When using template users (not supported by all PAM applications), **pam\_ldap** will set PAM\_USER to the value of this option if the user does not contain a template login attribute.

- **pam\_password \<protocol\>**

  Specifies the password change protocol to use. The following protocols are supported:

  - **clear**

    Change password using an LDAPModify request, replacing the userPassword value with the new cleartext password.

  - **clear\_remove\_old**

    Change password using an LDAPModify request, first removing the userPassword value containing the old cleartext password, and then adding the userPassword value with the new cleartext password. This protocol is necessary for use with Novell NDS and IBM RACF.

  - **crypt**

    Change password using an LDAPModify request, first generating a one way hash of the new password using **[crypt(3)](/crypt/3.md)** and then replacing userPassword value with the new hashed password.

  - **md5**

    Change password using an LDAPModify request, first generating a one way hash of the new password using MD5 and then replacing userPassword value with the new hashed password.

  - **nds**

    This is an alias for **clear\_remove\_old.**

  - **racf**

    This is an alias for **clear\_remove\_old.**

  - **ad**

    Change password using an LDAPModify request, using the Active Directory Services Interface (ADSI) password change protocol.

  - **exop**

    Change password using the RFC 3062 password modify extended operation (only the new password is sent).

  - **exop\_send\_old**

    Change password using the RFC 3062 password modify extended operation (both the old and new passwords are sent).

- **pam\_password\_prohibit\_message \<message\>**

  Specifies a message to send to users indicating that passwords cannot be changed. This could be used to redirect users to another means of changing passwords.

- **pam\_sasl\_mech \<mechanism\>**

  Specifies the SASL mechanism to use for PAM authentication. This requires SASL libraries be installed. Support for this functionality presently experimental and does not support password policy controls.

## PAM CONFIGURATION

It is possible to configure some aspects of **pam\_ldap** on a per-service basis, in the PAM configuration file (this is usually /etc/pam.conf; for PAM implementations based on Linux-PAM, per-service files in /etc/pam.d are also supported).

The following options may be specified as arguments to the **pam\_ldap** module:

- **config=\<path\>**

  Specifies that **pam\_ldap** should use the configuration file in **path** instead of pam\_ldap.conf to retrieve its global configuration. Configuring multiple instances of **pam\_ldap** for the same service with different configuration files is not supported, because the configuration information is cached.

- **use\_first\_pass**

  Specifies that **pam\_ldap** should always use the first password provided in the authentication stack.

- **try\_first\_pass**

  Specifies that **pam\_ldap** should first try the first password provided in the authentication stack, and then prompt the user for their *LDAP* password if authentication fails.

- **ignore\_unknown\_user**

  Specifies that **pam\_ldap** should return PAM\_IGNORE for users that are not present in *LDAP.* This forces the PAM framework to ignore the **pam\_ldap** module. This option is useful where certain accounts do not reside in *LDAP,* but one wishes to make **pam\_ldap** "required" for all accounts in the directory. In this case one would make both **pam\_ldap** and the other module (for example, pam\_unix) "required" and enable the **ignore\_unknown\_user** option. (For this to work, the other module must behave similarly for users in the directory; in the case of a module such as pam\_unix that uses the system accounts database, using **nss\_ldap(5)** should be sufficient to meet this requirement.)

- **ignore\_authinfo\_unavail**

  Specifies that **pam\_ldap** should return PAM\_IGNORE if it cannot contact the *LDAP* server. This option forces the PAM framework to ignore the **pam\_ldap** module in this case.

- **no\_warn**

  Specifies that warning messages should not be propagated to the PAM application.

- **use\_authtok**

  Analogous to **use\_first\_pass** for password changing only.

- **debug**

  This option is recognized by **pam\_ldap** but is presently ignored.

## AUTHOR

The **pam\_ldap** module was developed by PADL Software Pty Ltd (www.padl.com).

## FILES

- /etc/pam\_ldap.conf, /etc/pam\_ldap.secret, /etc/pam.conf

  ## SEE ALSO

[**pam**(8)](/pam/8.md)
