What is OpenLDAP?

OpenLDAP is a free and open-source implementation of the Lightweight Directory Access Protocol (LDAP). It provides a centralized directory service for storing user accounts, passwords, group information, and other directory-based data in a hierarchical and searchable format.

OpenLDAP is commonly used for:

  • Centralized user authentication
  • Address book services
  • Access control and identity management
  • Integration with Samba, Apache, Dovecot, sudo, and other Linux/UNIX services

Why Use OpenLDAP on Ubuntu 24.04?

Ubuntu 24.04 LTS is a modern, secure, and long-term supported platform. It provides a stable environment for directory services like OpenLDAP due to:

  • Support for OpenLDAP 2.5+ via APT
  • Updated systemd, AppArmor, and TLS 1.3 integration
  • Enhanced performance, logging, and IPv6 readiness
  • Compatibility with SSSD, Kerberos, and Samba for centralized authentication

Ubuntu’s LTS support until 2029 makes it ideal for enterprise-grade directory deployments.


Key Components of an OpenLDAP Setup

  • slapd – The LDAP directory server daemon
  • ldap-utils – Command-line tools to interact with the directory
  • LDIF (LDAP Data Interchange Format) – Text files used to represent directory entries
  • Schemas – Define object types, attributes, and relationships (e.g., inetOrgPerson)
  • Access Control Lists (ACLs) – Fine-grained permission rules for reading or modifying data
  • TLS – Secure LDAP communications with certificates (LDAPS)

Common Use Cases

  • Manage Linux server logins with centralized LDAP user accounts
  • Control access to internal applications (e.g., GitLab, Nextcloud, Zabbix)
  • Serve as a backend directory for mail servers or web-based address books
  • Provide identity backend for Samba/Active Directory compatibility
  • Store and query hierarchical organizational data (users, departments, etc.)

Advantages of OpenLDAP

FeatureDescription
ScalableSupports thousands of entries and replicas
Flexible SchemaSupports custom attribute types and object classes
InteroperableIntegrates with UNIX, Windows, macOS, and cloud services
SecureTLS, SASL, strong ACLs, and integration with PAM
CLI and GUI OptionsManage via CLI (ldapadd, ldapsearch) or GUIs like phpLDAPadmin or LDAP Account Manager (LAM)

Security Features

  • TLS encryption with X.509 certificates (for ldaps:// or StartTLS)
  • Strong password hashing (SSHA, BCRYPT)
  • Fine-grained ACLs to control read/write access
  • Integration with Kerberos or SASL for single sign-on (SSO)
  • Ability to restrict anonymous binds or specific operations

Tools and Interfaces

  • ldapsearch / ldapadd / ldapmodify / ldapdelete – Powerful command-line utilities
  • phpLDAPadmin – Web-based admin UI (optional)
  • LDAP Account Manager (LAM) – Feature-rich web interface for user/group management
  • SSSD – For LDAP-based login integration on Linux clients

Deployment Notes on Ubuntu 24.04

  • By default, slapd uses dynamic configuration under /etc/ldap/slapd.d
  • The traditional slapd.conf is deprecated
  • Ubuntu 24.04 supports systemd services, AppArmor, and automatic TLS provisioning
  • Configuration can be done interactively during install or manually via dpkg-reconfigure slapd

Typical Directory Structure

A default domain of example.com creates a base DN like:

dc=example,dc=com

Under which you’ll define entries such as:

  • ou=People – user entries
  • ou=Groups – group entries
  • cn=admin – admin (bind) user
  • uid=john.doe – individual user account

OpenLDAP on Ubuntu 24.04 offers a stable, secure, and fully-featured solution for directory-based identity and access management. Whether you’re deploying a centralized login system or integrating enterprise apps with LDAP authentication, Ubuntu 24.04 provides a modern, well-supported platform for OpenLDAP services.

Its compatibility with modern security protocols, web admin interfaces, and Linux integration tools makes it a powerful choice for organizations of all sizes.


🔹Create a Server Instance on Shape.Host

Before installation, provision a clean Ubuntu 24.04 VPS:

Go to https://shape.host and log in.

Click “Create”, then choose “Instance”.

Shape.host Resources dashboard with Create > Instance highlighted.

Set:

Location: your preferred region.

Shape.host instance form with the data center location selector highlighted.

OS: Ubuntu 24.04 (64-bit)

Plan: at least 2 CPUs, 2 GB RAM, 20 GB SSD

Shape.host instance form with the operating system image selector highlighted.

Click “Create Instance”.

Shape.host instance form with the Create Instance button highlighted.

After deployment, note your server’s IP address under Resources.

Shape.host Resources dashboard with the server IP address highlighted.

You’ll use this server to host your OpenLDAP environment.

Connect to Your Server via SSH

On Linux/macOS:

ssh root@your_server_ip

On Windows:

Use PuTTY, enter the IP, and connect as root.


🔹 Step 1: Update the System

apt update && apt upgrade -y
Terminal showing APT package management commands and output.

🔹 Step 2: Install OpenLDAP Server

apt install slapd ldap-utils -y
Terminal showing APT package management commands and output.

If not prompted, reconfigure manually:

dpkg-reconfigure slapd

During reconfiguration, choose:

  • Omit OpenLDAP server configuration? → No
  • DNS domain name: example.com → results in dc=example,dc=com
  • Organization name: Example Inc
  • Admin password: (choose securely)
  • Database backend: MDB
  • Do you want the database to be removed when slapd is purged? → No
  • Move old database? → Yes
Terminal showing dpkg commands or output during During reconfiguration, choose:.

🔹 Step 3: Verify LDAP Server

systemctl status slapd
Terminal showing systemd service management commands or output.

Test:

ldapsearch -x -LLL -H ldap://localhost -b dc=shape,dc=host
Terminal displaying LDAP directory query results.

🔹 Step 4: Install phpLDAPadmin (Optional GUI)

apt install phpldapadmin -y
Terminal showing APT package management commands and output.

Edit config:

nano /etc/phpldapadmin/config.php

Update these lines:

$servers->setValue('server','host','127.0.0.1');
$servers->setValue('login','bind_id','cn=admin,dc=shape,dc=host');
phpLDAPadmin configuration excerpt.

Edit Apache config:

nano /etc/apache2/conf-enabled/phpldapadmin.conf

Change:

Require local

To:

Require all granted
Terminal showing web server configuration text.

Restart Apache:

systemctl restart apache2

Now open:

http://51.89.69.203/phpldapadmin/
phpLDAPadmin welcome screen with directory navigation.

or (after DNS propagation):

http://ubuntu-tutorials.shape.host/phpldapadmin/

🔹 Step 5: Create Base LDAP Structure

Create file:

nano base.ldif
dn: ou=people,dc=shape,dc=host
objectClass: organizationalUnit
ou: people

dn: ou=groups,dc=shape,dc=host
objectClass: organizationalUnit
ou: groups
Terminal showing the GNU nano editor and configuration text.

Apply:

ldapadd -x -D cn=admin,dc=shape,dc=host -W -f base.ldif
Terminal showing nano commands or output during Step 5: Create Base LDAP Structure.

🔹 Step 6: Add an LDAP User

nano john.ldif
dn: uid=john,ou=people,dc=shape,dc=host
objectClass: inetOrgPerson
sn: Doe
givenName: John
cn: John Doe
uid: john
mail: john@shape.host
userPassword: password
Terminal showing the GNU nano editor and configuration text.

Then:

ldapadd -x -D cn=admin,dc=shape,dc=host -W -f john.ldif
Terminal showing nano commands or output during Step 6: Add an LDAP User.

🔐 You can hash the password using:

slappasswd

🔹 Step 7: Enable HTTPS (SSL) with Let’s Encrypt

Install Certbot:

apt install certbot python3-certbot-apache -y
Terminal showing APT package management commands and output.

Obtain SSL cert:

certbot --apache -d ubuntu-tutorials.shape.host

Choose redirect to force HTTPS access.

Terminal showing Certbot certificate commands and messages.

Final Access Points

phpLDAPadmin (Web GUI):

https://ubuntu-tutorials.shape.host/phpldapadmin/
phpLDAPadmin interface with an expanded directory tree.

Test LDAP:

ldapsearch -x -LLL -H ldap://localhost -b dc=shape,dc=host
Terminal displaying LDAP user and group directory entries.

This OpenLDAP setup runs best on fast, secure, and scalable cloud infrastructure.

Need reliable hosting?
Choose Shape.Host Cloud VPS for:

  • Enterprise-grade performance
  • SSD storage and high-availability locations
  • Full root access for maximum control
  • Instant deployment with Ubuntu 24.04 support