• Contact Us
  • Home
  • Installation
  • Platform

Enable Linux Logins Using LDAP Credentials

Learn how to configure your Linux system to allow users to log in using their LDAP credentials, making it easier to manage user accounts and access controls throughout your organization.

Written by Seaghan McNelis

Updated at March 31st, 2026

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

Step 1: Configure ldap.conf Step 2: Update nsswitch.conf Step 3: Install nslcd and nscd Step 4: Configure nslcd.conf Step 5: Install the CA Certificate Step 6: Enable nslcd Service Step 7: Restart Services Step 8: Test Connectivity

Date: 01-17-2022

These instructions apply to: RedHat/CentOS, Debian/Ubuntu and SuSE.

This guide walks you through enabling Linux logins using LDAP credentials. It covers configuring LDAP settings, updating NSS (Name Service Switch), and installing necessary services.

Step 1: Configure ldap.conf

Open /opt/symas/etc/openldap/ldap.conf on your LDAP server:

sudo vi /opt/symas/etc/openldap/ldap.conf

Add the following configuration:

BASE dc=example,dc=com
URI ldapi:///
TLS_CACERT /opt/symas/ssl/CACert.pem

 The TLS_CACERT setting is required only if using SSL certificates for encrypted connections.

The ldap.conf file is global and affects all LDAP server connections.

Step 2: Update nsswitch.conf

Edit the /etc/nsswitch.conf file to configure NSS to use LDAP:

sudo vi /etc/nsswitch.conf

Add ldap as follows:

passwd:          compat ldap 
group:           compat ldap 
shadow:          compat ldap 
gshadow:         files
hosts:           files dns myhostname
networks:        files
protocols:       db files
services:        db files
ethers:          db files
rpc:             db files
netgroup:        nis

This configuration prioritizes the local /etc/passwd file if a user is not found in LDAP.

Step 3: Install nslcd and nscd

Install the nslcd and nscd services as follows:

RedHat Linux and CentOS:

sudo yum install nss-pam-ldapd nscd -y

Debian and Ubuntu:

sudo apt-get install nslcd nscd -y

SUSE:

sudo zypper install nss-pam-ldapd nscd

Step 4: Configure nslcd.conf

The nslcd configuration file, /etc/nslcd.conf, defines connection settings for LDAP.

Open /etc/nslcd.conf:

sudo vi /etc/nslcd.conf

Update it with the following settings:

# Run as user and group nslcd
uid nslcd
gid nslcd
# Specify the LDAP server URI
uri ldap://ldapserver.example.com
# Set the search base
base dc=example,dc=com
# Use LDAP protocol version 3
ldap_version 3
# Bind DN and password for lookups (ensure this file is protected)
binddn uid=system-authority,ou=applications,dc=example,dc=com
bindpw <plaintext_password>
# SSL options (if using SSL)
tls_cacertfile /etc/ssl/certs/<ldap server CA>.crt
# Set search scope
scope sub
# Ignore local users in NSS group queries
nss_initgroups_ignoreusers ALLLOCAL

Step 5: Install the CA Certificate

Copy the CA.crt file from your LDAP server to the client’s SSL certificate directory:

sudo cp /path/to/CA.crt /etc/ssl/certs/

Step 6: Enable nslcd Service

On Debian-based systems, enable nslcd to start on boot:

sudo update-rc.d nslcd enable

Step 7: Restart Services

After configuration, restart both nscd and nslcd:

sudo systemctl restart nscd
sudo systemctl restart nslcd

Step 8: Test Connectivity

Use the getent command to test LDAP connectivity and verify user information:

getent passwd | grep <ldap uid>

If the configuration is correct, the command will display the LDAP user entry.

Example Output:

jtrupp:x:1000:1000:Jason Trupp,,,:/home/jtrupp:/bin/bash
jtrupp:x:2029:2029:Jason Trupp:/home/jtrupp:/bin/bash
Copyright © 2020-2024 Symas Corporation. All rights reserved.
nsswitch nscd nslcd

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Basic Security Certificate Setup
  • Core File Retention
  • Creating Core Dumps
  • LetsEncrypt Certificates on Ubuntu
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2025, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand