How to create a simple LDAP Database on Linux

How to create a simple LDAP Database on Linux

Creating a simple LDAP Database on Linux.

Installing and configuring slapd

We are going to use OpenLDAP(slapd) to build a LDAP database accessible for the security module WITHOUT simulating an Active Directory. This tutorial will create an LDAP server and a single user for access.


Image 01: Installing slapd.

In a Debian-based system, we need to use apt-get to retrieve and install slapd.


Image 02: Using dpkg-reconfigure to change slapd settings.

After the installation, we must configure the settings for the slapd. To do so, we must use dpkg-reconfigure to build.


Image 03: Configuring slapd.

Select the "No" option and press Enter to continue.


Image 04: Defining domain name.

Choose your domain name.


Image 05: Defining organization name.

Type the organization name and press Enter to continue.


Image 06: Setting up admin password.

Define the admin password and press Enter to confirm it.


Image 07: Purging previous DB.


Image 08: Moving old files.

Adding a new user

First of all, you must create a LDIF file with the info about the user on it:
user@computer:~$ touch hbarros.ldif

This is the content we are using for this sample file:


# Object 1: uid=hbarros,dc=lpessoa,dc=scriptcase,dc=info
dn: uid=hbarros,dc=lpessoa,dc=scriptcase,dc=info
objectclass: account
objectclass: simpleSecurityObject
objectclass: top
uid: hbarros
userpassword: {MD5}6jAUXhUfuutm7cbFC6oVUA==


Now we are ready to put it on the database itself.

Get admin rights:
user@computer:~$ su

Stop the lapd service:
root@computer:/home/user# /etc/init.d/sladp stop

Use slapadd to import the file:
root@computer:/home/user# slapadd -l /home/user/hbarros.ldif

Restart the service.
root@computer:/home/user# /etc/init.d/slapd start




This tutorial created a LDAP authentication environment. The authentication data for this example are:

User Name

    • Related Articles

    • How to create a LDAP Database on Windows Server

      Creating a LDAP Database on Windows Server. Server Manager Image 01: Server manager option on the startup menu. In Windows Server is natively possible to create a LDAP database to feed an Active Directory structure. We will need to access the Server ...
    • Manual Update - Linux

      Before performing any procedure we recommend performing a backup of your projects. To back up Scriptcase: Go to Options > Settings, in the side menu go to Services > Backup. A file (.ZIP) will be generated with all your projects, save this file to a ...
    • Installing PHP 7.3 - Linux

      his documentation will teach all the steps necessary for the installation of the PHP 7.0, Apache 2.4 and the Scriptcase using the manual installation in the Linux environment. Doing this kind of installation you will be responsible for configuring ...
    • Install ScriptCase PHP 7.0 on a XAMPP on Linux

      Xampp Installation Using PHP 7.0 XAMPP It allows you to easily install Apache on your own computer, regardless of your operating system (Linux, Windows, MAC or Solaris). First you have to proceed to download XAMPP PHP ...
    • Connection with MSSQL Database

      Scriptcase has 3types of connections that can be used to communicate with Database MSSQL Server. - MSSQL Server Native SRV PDO - MSSQL Server Native SRV - MSSQL Server ODBC 1. Connection ODBC (MSSQL Server ODBC)  This connection may be used on the ...