For ease of password administration and management, sometimes it’s better to join to a conformed directory structure. In this case LDAP is what we are using — specifically a 389 Directory Server, with the CentOS client talking to it through nss-pam-ldapd and authconfig. This keeps the original authconfig-tui flow, then notes the modern authselect/sssd approach on AlmaLinux and RHEL 8+.
Prerequisites
- A working 389 Directory Server with a Base DN (this example uses
dc=domain,dc=comon192.168.1.201). - Root on the CentOS client, and network access to the LDAP port (389 or 636).
- The LDAP server’s CA certificate if you will turn on TLS (optional in this walkthrough; Use TLS was left unchecked).
1. Become root on the CentOS client
Login to your CentOS Client, and su to root.

2. Install the LDAP client packages
Install the necessary tools. The package that provides the nss/PAM LDAP daemon used here is nss-pam-ldapd:
yum install nss-pam-ldapd

On many CentOS 6 systems you also want authconfig / authconfig-gtk for the TUI, and openldap-clients for ldapsearch tests. Install those if they are missing.
3. Launch authconfig-tui
Launch authconfig-tui:
authconfig-tui

4. Enable LDAP user information and authentication
Configure as shown below: under User Information select Use LDAP; under Authentication select Use Shadow Passwords, Use LDAP Authentication, and Local authorization is sufficient, then choose Next.

5. Set the LDAP server and Base DN
Customize for your environment. In LDAP Settings set the Server URI and Base DN — here ldap://192.168.1.201/ and dc=domain,dc=com. Leave Use TLS unchecked unless you have already distributed a CA certificate to the client.


Started! authconfig writes /etc/nslcd.conf, /etc/pam.d/* and the NSS LDAP settings, and starts nslcd.
6. Create home directories automatically
Tell this box to automatically create home directories when an LDAP user logs in for the first time:
authconfig --enablemkhomedir --update

You should see nslcd start with [ OK ]. That’s it!
Verify
getent passwd some_ldap_user
id some_ldap_user
ldapsearch -x -H ldap://192.168.1.201/ -b dc=domain,dc=com '(uid=some_ldap_user)'
getent and id should resolve the LDAP user. Then SSH in as that user and confirm a home directory appears under /home.
Troubleshooting
- getent shows nothing: nslcd is not running, or the Base DN/URI is wrong. Check
service nslcd statusand the URI in/etc/nslcd.conf. - Login fails but getent works: PAM LDAP authentication is off, or the user password is not in the directory. Re-run authconfig-tui and confirm Use LDAP Authentication.
- TLS errors: if you enable Use TLS, install the CA under
/etc/openldap/cacertsand runcacertdir_rehash /etc/openldap/cacerts(or pointtls_cacertfilein nslcd.conf). See 389 Directory Server TLS Client CentOS.
AlmaLinux, Rocky Linux and RHEL 8–10
authconfig-tui is removed. Use authselect with SSSD (recommended) or install nss-pam-ldapd and configure /etc/nslcd.conf by hand:
dnf install sssd authselect oddjob-mkhomedir
authselect select sssd with-mkhomedir --force
# then edit /etc/sssd/sssd.conf for your ldap_uri and ldap_search_base
systemctl enable --now sssd oddjobd
authconfig --enablemkhomedir is replaced by the with-mkhomedir authselect feature plus oddjobd.
Hosted Linux Servers at www.zwiegnet.com/go
Related guides: Install 389 Directory Server CentOS | 389 Directory Server TLS Client CentOS
