Skip to Content

Integrate OpenLdap with CentOS using SSSD

How to integrate OpenLdap with Centos 8 using SSSD?

 
 
Run the following commands to install the SSSD packages
 

[[email protected] ~]# yum install sssd sssd-client nscd -y

 
Add ldap_search_base,ldap_default_bind_dn,ldap_default_authtok,ldap_uri to /etc/sssd/sssd.conf
 
  

[sssd]
services = nss, pam
config_file_version = 2
domains = default

[nss]

[pam]
offline_credentials_expiration = 60

[domain/default]
ldap_id_use_start_tls = False
cache_credentials = True
ldap_search_base = dc=ldap,dc=ez,dc=com
id_provider = ldap
auth_provider = ldap
chpass_provider = ldap
access_provider = ldap
ldap_uri = ldap://192.168.1.10
ldap_default_bind_dn = cn=admin,dc=ldap,dc=ez,dc=com
ldap_default_authtok = paswword
ldap_search_timeout = 50
ldap_network_timeout = 60
ldap_access_order = filter
ldap_access_filter = (objectClass=posixAccount)
override_shell = /usr/local/bin/ezsh

    
Restart sssd and nscd using below commands.
 

[[email protected] ~]# service sssd restart && service nscd restart

When sssd restart fails, make sure to change the permissions of sssd.conf to 600

[[email protected] ~]# chmod 600 /etc/sssd/sssd.conf

  
Enable autocreate home directory on login by the following command  

authconfig --enablemkhomedir --update

 
Now run the id / finger command and see whether you are able to get LDAP user details 
 

[[email protected] ~]# finger marc

Login: marc             Name: Marc c

Directory: /home/marc   Shell: /usr/local/bin/ezsh

Last login Wed Jun 13 05:02 (EDT) on pts/1 from 10.1.1.13

No mail.

No Plan.

[[email protected] ~]# id marc

uid=1001(marc) gid=20001(domain users) groups=1547600513(domain users)

[email protected] ~]# getent passwd marc
marc:*:1701601108:1701600513:marc user:/home/[email protected]:/usr/local/bin/ezsh

 

Use the below command to clear the cache of the user.

[[email protected] ~]#  sss_cache -u username