LDAP Backup and Restore

LDAP Backup and Restore

by -
0 1921

LDAP Backup

LDAP is Lightweight Directory Access Protocol, in our last post we used LDAP as a database with SAMBA PDC and store all the user information. Now we will learn how to take backup of ldap sever and how to restore this backup.

Step1: Make a directory first, where we will store data

[[email protected] ~]# mkdir /home/backups

Step2: Now we will take the backup, the backup file will be save in .ldif format

[[email protected] ~]# /usr/sbin/slapcat -v -b “cn=Manager,dc=example,dc=com” -l /home/backups/ldapback.ldif

Our backup file is ldapback.ldif

LDAP Restore

Now we will restore the backup file.

Step1: Stop ldap service first

Stop slapd service

[[email protected] ~]# /etc/init.d/slapd stop

Stopping slapd: [ OK ]

Step2: Now remove ldap database

[[email protected] ~]# cp -rpf /var/lib/ldap /var/lib/ldap.org
[[email protected] ~]# cd /var/lib/ldap
[[email protected] ldap]# rm -rf *

Now log in on LAM(Ldap Account Manager) with password, you will get error.

Screenshot from 2015-06-01 18:27:09


Step3: Restore the backup

[[email protected] ~]# /usr/sbin/slapadd -v -b “cn=Manager,dc=example,dc=com” -l /home/backups/ldapback.ldif

Screenshot from 2015-06-01 19:03:05

[[email protected] ~]# chown -R ldap. /var/lib/ldap
[[email protected] ~]# /etc/init.d/slapd start
Starting slapd: [ OK ]

Now login on LAM and check password.


Download PDF

CEO, KV IT-Solutions Pvt. Ltd. | [email protected] | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “


0 1700

0 1355

0 1218


Leave a Reply