LDAP stands for Lightweight Directory Access Protocol which is an industry-standard application protocol for maintaining and accessing directory information services over IP networks. Directory information services match resources information to their respective IP addresses. LDAP's role is to store emails, accounts, and passwords in a central location, and some applications will use this data for authentication.
In this context, we shall look into configuring the LDAP client on Ubuntu 20.04.
Steps to configure the LDAP client on Ubuntu
1. Install LDAP client utilities
To begin, Run apt command to install the utilities associated:
$ sudo apt install libnss-ldap libpam-ldap ldap-utils
In the output, you will set up the URL of the LDAP server.
Next, Press Ok to continue.
2. Set domain for LDAP client
Now, set up the domain name of the LDAP server.
The first dc represents the name part, the second dc represents the tail. Press Ok to next.
3. Select LDAP version
Here, choose the latest LDAP version. After selection, Press Ok to continue.
4. Set admin for root database
Now you can make local root Database admin. Press Enter to next.
5. Set LDAP databaselogin preference
You will see a screen when you will prompted if the LDAP database requires login, so you can choose Choose Yes and press Enter.
6. Set Username
Now, enter the username at the cn option. Press Ok.
7. Choose password
Here, Choose a password and select OK to continue.
8. Set username for privileged account
Here type in a different username with a privileged account at cn. Press Enter to next.
9. Enter password for database login account
Now type the password. After completing the above command will be active.
10. Update PAM-auth file
With LDAP for authentication, update the PAM-auth file with the below command:
$ sudo pam-auth-update
Then, Press Ok to continue.
How to create user home directory for LDAP ?
To make some migration changes the PAM directory public session file can be edited. Open nano editor:
$ sudo nano /etc/pam.d/common-session
At the end of the file, let's add:
session required pam_mkhomedir.so skel=/etc/skel umask=077
Save it and exit.
How to uninstall LDAP client from your Ubuntu Linux 20.4 system ?
If you don't want to use the LDAP client, run the following command to remove it:
$ sudo apt-get purge libnss-ldap libpam-ldap ldap-utils