OpenLdap
OpenLDAP is a free, open-source implementation of the Lightweight Directory Access Protocol (LDAP) developed by the OpenLDAP Project.
Installation
You can install openldap with the following command
sudo apt install slapd ldap-utils
You can reconfigure the openldap server with the following command
sudo dpkg-reconfigure slapd
You can reconfigure the cn=admin and domain as nitesh.com . Please don't forgot to remember the password that you have entered for the cn and domain creation
This is what the dc=nitesh,dc=com DIT looks like:
ldapsearch -x -LLL -H ldap:/// -b dc=nitesh,dc=com dn
dn: dc=nitesh,dc=com
dn: cn=admin,dc=nitesh,dc=com
User Creation
Initially we have to create a organization unit. You can create ou by adding this openldap_ou.ldif
dn: ou=openldap,dc=nitesh,dc=com
dc: openldap
objectClass: dcObject
objectClass: organizationalUnit
ou: openldap
Use below command for adding ou to this ldap database
ldapadd -x -D "cn=admin,dc=nitesh,dc=com" -W -f openldap_ou.ldif
Create users for OpenLdap. Initially we have to create openldap_user1.ldif
dn: uid=openldap_user1,ou=openldap,dc=nitesh,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: openldap_user1
sn: OLUser1
givenName: User1
cn: openldap_user1
displayName: openldap_user1
uidNumber: 1810
gidNumber: 1700
userPassword: openldap_user1
gecos: Openldap User1
homeDirectory: /home/openldap_user1
Add user with following command
ldapadd -x -D "cn=admin,dc=nitesh,dc=com" -W -f openldap_user1.ldif
You can check with ldapsearch command if the user is added to the database or not
ldapsearch -h localhost -x -D "cn=admin,dc=nitesh,dc=com" -W