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

 

 

Results

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

Domain
LPESSOA
DN
DC=lpessoa,DC=scriptcase,DC=info
User Name
UID=hbarros,DC=scriptcase,DC=info

    • 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 ...
    • Instalando PHP 7.3 - Linux

      Esta documentación le indicará los pasos necesarios para hacer la instalación del PHP 7.3, Apache 2.4 y Scriptcase de forma manual en un entorno Linux. Haciendo ese tipo de instalación, usted es responsable por toda la configuración de su entorno, ...
    • Instalando PHP 7.0 - Linux

      Este artículo describirá la instalación de PHP 7.0 y Apache 2.4 para el uso de ScriptCase. Sistemas operativos compatibles: Ubuntu Debian CentOS\RHEL OpenSuse Archivos Necesarios: SourceGuardian Loader (ixed.7.0.lin): haga clic aquí Configurando PHP ...
    • Instalación del servicio Firebird 3.0 y administrador de bases de datos en Linux

      1- Primero debemos agregar los repositorios para Linux ingresando el siguiente comando en el terminal: sudo add-apt-repository ppa: mapopa / firebird3.0 2- Continúe con la actualización e inspeccione si el paquete se instaló para su uso, inserte los ...
    • Create a folder using PHP code

      To create a folder on the server partition, use the PHP command: mkdir (); In the example below, I will create a folder where your name will be the current system date. <php $folder = date("Ymd");mkdir ($folder, 0755); ?> The value "0755", will be ...