

Install and Configure OpenLDAP Server on Ubuntu 20.04|18.04 LTS
source link: https://computingforgeeks.com/install-and-configure-openldap-server-ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

In this blog post you’ll get to learn how to Install and configure OpenLDAP Server on Ubuntu 20.04|18.04 LTS. OpenLDAP is a free and open source implementation of the Lightweight Directory Access Protocol developed by the OpenLDAP Project and released under OpenLDAP Public License.
Before you start the installation, set your system hostname:
sudo hostnamectl set-hostname ldap.example.com
Add the IP and FQDN to file /etc/hosts
.
$ sudo vim /etc/hosts
192.168.18.50 ldap.example.com
Replace ldap.example.com
with your correct hostname/valid domain name. When done, install LDAP packages by running the commands below:
sudo apt update
sudo apt -y install slapd ldap-utils
During the installation, you’ll be prompted to set LDAP admin password
, provide your desired password, then press <OK>
Confirm the password and continue installation by selecting <ok> with TAB key.
You can confirm that your installation was successful using the commandslapcat
to output SLAPD database contents.
# slapcat
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: example.com
dc: example
structuralObjectClass: organization
entryUUID: e33fc814-e5b9-1038-8243-39a2e6b74e62
creatorsName: cn=admin,dc=example,dc=com
createTimestamp: 20190328152831Z
entryCSN: 20190328152831.511390Z#000000#000#000000
modifiersName: cn=admin,dc=example,dc=com
modifyTimestamp: 20190328152831Z
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9WDIzUEJxbXgycUU3M1dRUmppTVYrZE91U0RNMWswSHE=
structuralObjectClass: organizationalRole
entryUUID: e340fedc-e5b9-1038-8244-39a2e6b74e62
creatorsName: cn=admin,dc=example,dc=com
createTimestamp: 20190328152831Z
entryCSN: 20190328152831.519463Z#000000#000#000000
modifiersName: cn=admin,dc=example,dc=com
modifyTimestamp: 20190328152831Z
Step 2: Add base dn for Users and Groups
The next step is adding a base DN for users and groups. Create a file named basedn.ldif
with below contents:
$ vim basedn.ldif dn: ou=people,dc=example,dc=com objectClass: organizationalUnit ou: people dn: ou=groups,dc=example,dc=com objectClass: organizationalUnit ou: groups
Replace example and com
with your correct domain components.
Now add the file by running the command:
$ ldapadd -x -D cn=admin,dc=example,dc=com -W -f basedn.ldif
Enter LDAP Password:
adding new entry "ou=people,dc=example,dc=com"
adding new entry "ou=groups,dc=example,dc=com"
Step 3: Add User Accounts and Groups
Generate a password for the user account to add.
$ slappasswd
New password:
Re-enter new password:
{SSHA}Zn4/E5f+Ork7WZF/alrpMuHHGufC3x0k
Create ldif file for adding users.
$ vim ldapusers.ldif
dn: uid=computingforgeeks,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
cn: computingforgeeks
sn: Wiz
userPassword: {SSHA}Zn4/E5f+Ork7WZF/alrpMuHHGufC3x0k
loginShell: /bin/bash
uidNumber: 2000
gidNumber: 2000
homeDirectory: /home/computingforgeeks
- Replace computingforgeeks with the username to add
- dc=example,dc=com with your correct domain values.
- cn & sn with your Username Values
- {SSHA}Zn4/E5f+Ork7WZF/alrpMuHHGufC3x0k with your hashed password
When done with edit, add account by running.
$ ldapadd -x -D cn=admin,dc=example,dc=com -W -f ldapusers.ldif Enter LDAP Password: adding new entry "uid=computingforgeeks,ou=people,dc=example,dc=com"
Do the same of group. Create ldif file:
$ vim ldapgroups.ldif dn: cn=computingforgeeks,ou=groups,dc=example,dc=com objectClass: posixGroup cn: computingforgeeks gidNumber: 2000 memberUid: computingforgeeks
Add group:
$ ldapadd -x -D cn=admin,dc=example,dc=com -W -f ldapgroups.ldif Enter LDAP Password: adding new entry "cn=computingforgeeks,ou=groups,dc=example,dc=com"
You can combine the two into single file.
Step 4: Install LDAP Account Manager – Recommended
I noticed phpLDAPadmin doesn’t work well with PHP 7.2+. I recommend you use LDAP Account Manager instead. Follow our guide below to install and configure LDAP Account Manager.
Install and configure LDAP Account Manager on Ubuntu
The guide also shows you how to add user accounts and groups to your LDAP server.
Step 5: Configure your Ubuntu 20.04|18.04 as LDAP Client
The last step is to configure the systems in your network to authenticate against the LDAP server we’ve just configured:
Configure LDAP Client on Ubuntu
Step 6: Securing LDAP Server/Client
Secure your LDAP Server and access from LDAP Client with TLS/SSL:
Secure LDAP Server with SSL/TLS on Ubuntu
Wrapping Up
Thanks for using our guide to install and configure OpenLDAP server on your Ubuntu. I recommend installing and using LDAP Account Manager to administer your LDAP server through a web interface.
If you need an advanced centralized user management platform, see
How to Install and Configure FreeIPA Server on Ubuntu
Recommend
-
16
Install Ubuntu Server 20.04.1 LTS 64-bit on Raspberry Pi I was trying to get Ubuntu Server 20.04.1 LTS Focal Fossa installed on a Raspberry Pi 3 B+. While this seems like it should have been a straig...
-
8
Install OpenLDAP & phpLDAPadmin on Ubuntu 20.40|18.04Search ComputingForGeeksOpenLDAP is a free and open...
-
12
Install and Configure OpenLDAP Server on CentOS 8This tutorial will cover how to install OpenLDAP on CentOS 8. LDAP is a lightweight domain authentication protocol. This means that you can use LDAP as a central authentication system for both...
-
15
Install Microsoft SQL Server 2019 on Ubuntu 20.04/18.04/16.04 LTSSearch ComputingForGeeksMS SQL is a relatio...
-
8
How To Install Seafile Server On Ubuntu 20.04|18.04 LTSSearch ComputingForGeeksIn this blog post, I’ll show...
-
8
<?xml encoding="utf-8" ??>Introduction Docker Swarm is a container orchestration tool. That is, it allows for creation of a cluster of docker hosts and turns them into a single virtual server. T...
-
6
<?xml encoding="utf-8" ??>Introduction Code-server is an open-source server application that serves Visual Studio Code on a remote server, accessible through a browser. Code-server allows develo...
-
10
Using a Different System? ...
-
20
Install Chef Automation Server on Ubuntu 18.04 LTSSearch ComputingForGeeksIn this guide, we will cover the i...
-
4
How to Install OpenLDAP on Ubuntu 22.04 OpenLDAP is a software implementation of the Lightweight Directory Access Protocol (LDAP). OpenLDAP is free and open-source software that comes with its own BSD-style license called OpenLDAP Public...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK