Configure a Linux host to resolve and authenticate users from a centralized directory service using LDAP client components. Validate the full path from name service resolution to a working login session with evidence-based checks.
Your company is transitioning from local accounts to a centralized authentication system. Your job is to install the LDAP client stack, configure the base DN and server URI, and verify that directory users can be resolved and authenticated like normal local accounts.
In practice, “it’s configured” means nothing until
getent resolves an identity and a login
actually succeeds.
getent.getent and controlled login simulation.
sudo apt install ldap-utils libnss-ldap libpam-ldap nscd
This pulls in the LDAP client tools plus the NSS and PAM
components that allow the system to resolve directory users
and authenticate them, with nscd providing caching.
sudo dpkg-reconfigure ldap-auth-config
This guided configuration sets the directory search base (base DN) and server endpoint (URI). That information becomes the lookup foundation for NSS and PAM LDAP modules.
LDAP server Uniform Resource Identifier:
ldap://ldap.example.com/
Distinguished name of the search base:
dc=example,dc=com
LDAP version to use: 3
sudo systemctl restart nscd
Restarting nscd clears cached name service
results so your getent checks reflect the current
LDAP configuration.
getent.
getent passwd jdoe
This is the critical resolution proof. If NSS is correctly wired to LDAP, the user appears as if it were local.
jdoe:x:1003:1003:John Doe:/home/jdoe:/bin/bash
cat /etc/pam.d/common-auth
PAM is the authentication layer. This check confirms the LDAP PAM module is present in the auth stack so directory credentials can be validated.
auth sufficient pam_ldap.so
auth required pam_unix.so nullok_secure
sudo passwd -l sysadmin
Locking an account is a fast containment control when you are transitioning identity sources or suspect misuse.
su - jdoe
Resolution is not the same as authentication. A successful
su - proves PAM can authenticate the directory
user and build a working login environment.
whoami
jdoe
This final proof is simple and direct: the session is actually running as the directory user.
ldap-utils
: Client tooling for LDAP queries and troubleshooting.
libnss-ldap
: NSS integration so directory users can be resolved via
standard interfaces (getent).
libpam-ldap
: PAM module enabling directory-backed authentication.
nscd
: Name Service Cache Daemon; caches NSS results.
dpkg-reconfigure ldap-auth-config
: Reconfigures LDAP auth parameters (URI, base DN).
getent passwd <user>
: Verifies NSS can resolve the user from configured sources.
/etc/pam.d/common-auth
: PAM stack file for authentication rules on Debian-family systems.
passwd -l <user>
: Locks an account by disabling password-based login.
su - <user>
: Simulates a login shell for a user and exercises PAM auth.