LDAP Backup and Restore

LDAP Backup and Restore


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

[root@ldap ~]# mkdir /home/backups

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

[root@ldap ~]# /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

[root@ldap ~]# /etc/init.d/slapd stop

Stopping slapd: [ OK ]

Step2: Now remove ldap database

[root@ldap ~]# cp -rpf /var/lib/ldap /var/lib/ldap.org
[root@ldap ~]# cd /var/lib/ldap
[root@ldap 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

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

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

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

Now login on LAM and check password.

Enjoy..!!!

Linux Engineer At
KV IT-Solutions Pvt. Ltd.
Download PDF

SIMILAR ARTICLES

NO COMMENTS

Leave a Reply

Required Captcha *