LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-26-2008, 12:58 AM   #1
gimmereeson
LQ Newbie
 
Registered: Jan 2007
Posts: 24

Rep: Reputation: 15
Backup and restore ldap databases


Hello,

Please let me know where exactly the ldap databases are stored . I use the default bdb databases with ldap .
Also please let me know how I can backup and restore the ldap databases in case of a server crash .

Thanks
 
Old 02-26-2008, 02:56 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
You can use slapcat to backup your database
Code:
man slapcat
for options

Regards
 
Old 02-26-2008, 04:08 AM   #3
gimmereeson
LQ Newbie
 
Registered: Jan 2007
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks for the response bathory . Where are all the ldap databases stored ? As mentioned in slapd.conf , they are stored as .bdb databases in
/var/lib/ldap folder . I was successfully able to query the database even after moving them to another location . Are the databases really located there ? How do I restore the backed up databases in case of a server
crash ? do I have to delete the old databases and restore from the ldif files created by slapcat ? Please let me know .
 
Old 02-26-2008, 04:50 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
As mentioned in slapd.conf , they are stored as .bdb databases in
/var/lib/ldap folder . I was successfully able to query the database even after moving them to another location . Are the databases really located there ?
The databases are located where slapd.conf says. I guess that you didn't restart slapd after moving them, so you got an cached answer.
Anyway you should stop slapd and delete the contents of the above mentioned directory when you want to do a restore using slapadd. Take a look at this and this for more details.

Regards
 
Old 02-26-2008, 05:15 AM   #5
gimmereeson
LQ Newbie
 
Registered: Jan 2007
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks you so much .
And yes I didn't restart ldap after moving the dbs to a separate location . I am very new to ldap and just testing my server before actually deploying it .
In the slapd.conf file I made sure to include /etc/openldap/schema/inetorgperson.schema
But when I use the password migration script to convert password map to ldif format I always see that only
'account' comes up as the default object class in the ldif files . Here is an example of what one of the ldif entries looks like :
--------------------------------------------
dn: uid=axe,ou=People,dc=example,dc=com
uid: axe
cn: axe
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$8EJTU0c0$O2oc9gwyMJZl0hFg7x6Y7.
shadowLastChange: 12371
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 500
gidNumber: 500
homeDirectory: /home/axe
--------------------------------------------
How do I make sure that inetorgperson comes up as the default object class without having to add it manually .
Also is it possible to change the object class of a record to another object class from a different tree ? Should I delete the existing record to make this change ?

Thanks
 
Old 02-26-2008, 05:57 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
There is no default objectclass. If "objectClass: inetOrgPerson" does not exist you should add it.
Quote:
Also is it possible to change the object class of a record to another object class from a different tree ? Should I delete the existing record to make this change ?
I'm afraid I don't understand what you mean by that.
 
Old 02-26-2008, 06:45 AM   #7
gimmereeson
LQ Newbie
 
Registered: Jan 2007
Posts: 24

Original Poster
Rep: Reputation: 15
I changed the object class in the ldif file mentioned from 'account' to 'inetorgperson' and tried to modify it with

ldapmodify -x -D "cn-Manager,dc=example,dc=com" -W -f /etc/openldap/axe.ldif
and the answer was something like object class violation and the verbose result says that modification of object class from account to inetorgperson is not allowed . Is this kind of a change posssible ? If so how to achieve it ?

Thanks
 
Old 02-26-2008, 07:46 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
You should read this to see why you cannot do what you want
You can just add "objectclass: inetorgperson":
Code:
dn: uid=axe,ou=People,dc=example,dc=com
changetype: add
objectclass: inetorgperson
...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot restore backup jon23d Linux - General 2 11-02-2006 05:24 PM
Backup and restore magasem AIX 7 07-30-2006 01:36 PM
Backup Restore to new PC tjabaut Linux - Hardware 2 07-14-2006 11:01 PM
restore backup nkeever Linux - Newbie 2 06-19-2006 09:03 AM
Need to restore databases! newuser455 Linux - Software 5 04-19-2006 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration