Open LDAP step by step installation and configuration
In this article we will learn about step by step installation and configuration of LDAP.
To learn about Basic of LDAP, Click here.
http://blog.eduguru.in/ldap-basic-of-open-ldap-introduction-to-ldap/
Install Open LDAP:
# yum install *openldap* -y
Start the Services:
# chkconfig –levels 235 ldap on
# service ldap start
Create LDAP root user password:
# slappasswd
New password:
Re-enter new password:
Update /etc/openldap/slapd.conf for the root password:
# vi /etc/openldap/slapd.conf
#68 database bdb
#69 suffix “dc=t4test,dc=com”
#70 rootdn “cn=Manager,dc=t4test,dc=com”
#71 rootpw {SSHA}cWB1VzxDXZLf6F4pwvyNvApBQ8G/DltW
Restart Services:
# service ldap restart
Create a test user:
# useradd test1
# useradd test2
Set User’s Password:
# passwd test1
Changing password for user test1.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
# passwd test2
Changing password for user test2.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully
Repeat the same for the rest of users.
Migrate local users to LDAP
# grep root /etc/passwd > /etc/openldap/passwd.root
# grep test1 /etc/passwd > /etc/openldap/passwd.test1
# grep test2 /etc/passwd > /etc/openldap/passwd.test2
Update default settings on file /usr/share/openldap/migration/migrate_common.ph
#71 $DEFAULT_MAIL_DOMAIN = “t4test.com”;
#74 $DEFAULT_BASE = “dc=t4test,dc=com”;
Convert passwd.file to ldif (LDAP Data Interchange Format) file
#/usr/share/openldap/migration/migrate_passwd.pl /etc/openldap/passwd.root /etc/openldap/root.ldif
#/usr/share/openldap/migration/migrate_passwd.pl /etc/openldap/passwd.test1 /etc/openldap/test1.ldif
#/usr/share/openldap/migration/migrate_passwd.pl /etc/openldap/passwd.test2 /etc/openldap/test2.ldif
Update root.ldif file for the “Manager” of LDAP Server
# vi /etc/openldap/root.ldif
#1 dn: uid=root,ou=People,dc=t4test,dc=com
#2 uid: root
#3 cn: Manager
#4 objectClass: account
Create a domain ldif file (/etc/openldap/t4test.com.ldif)
# cat /etc/openldap/t4test.com.ldif
dn: dc=t4test,dc=com
dc: t4test
description: LDAP Admin
objectClass: dcObject
objectClass: organizationalUnit
ou: rootobject
dn: ou=People, dc=t4test,dc=com
ou: People
description: Users of t4test
objectClass: organizationalUnit
Import all users in to the LDAP
Add the domain ldf file:
# ldapadd -x -D “cn=Manager,dc=t4test,dc=com” -W -f /etc/openldap/t4test.com.ldif
Enter LDAP Password:
adding new entry “dc=t4test,dc=com”
adding new entry “ou=People, dc=t4test,dc=com”
Add the users:
# ldapadd -x -D “cn=Manager,dc=t4test,dc=com” -W -f /etc/openldap/root.ldif
Enter LDAP Password:
adding new entry “uid=root,ou=People,dc=t4test,dc=com”
adding new entry “uid=operator,ou=People,dc=t4test,dc=com”
Repeat this for all the user.
Restart the LDAP service
# service ldap restart
Print all the user information:
# ldapsearch -x -b ‘dc=t4test,dc=com’ ‘(objectclass=*)’
Pingback: LDAP : Basic of Open LDAP: Introduction to LDAP | Eduguru - Good Blogging
It’s very straightforward to find out any matter on web as
compared to books, as I found this article at this web
site.