Re: ldap re-creating database
Arrrrgh, I am going crazy here. Going very basic now and still can't
seem to be able to use ldapadd like the documentation suggests. Here is
what I have just tried.
1. Stopped slapd:
/etc/init.d/slapd stop
2. Removed all files in /var/lib/ldap/
rm /var/lib/ldap/*
3. Created a /etc/ldap/slapd.conf file containing:
---
pidfile /var/run/slapd.pid
argsfile /var/run/slapd.args
replogfile /var/lib/ldap/replog
loglevel 0
database ldbm
suffix "dc=mycompany,dc=com"
directory "/var/lib/ldap"
rootdn "cn=admin,dc=mycompany,dc=com"
rootpw {SSHA}jqn1eATMlywgjN1EnGRihUBxzHDKJQMR
---
4. Start slapd:
/etc/init.d/slapd start
5. Confirm that slapd is working
ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
This replies with:
dn:
namingContexts: dc=mycompany,dc=com
6. Created a basic base.ldif file
---
dn: dc=mycompany,dc=com
dc: mycompany
objectClass: dcObject
objectClass: organization
o: MIT Devin
dn: cn=admin,dc=mycompany,dc=com
cn: admin
objectClass: organizationalRole
---
7. Try to ldapadd the base.ldif file:
ldapadd -x -W -f base.ldif
Enter LDAP Password:
adding new entry "dc=mycompany,dc=com"
ldap_add: Already exists
ldif_record() = 68
OK so it exists already which isn't what the docs suggest should happen.
But anyway, I change the base.ldif file by removing the first entry,
leaving only the admin entry.
8. So now base.ldif looks like:
---
dn: cn=admin,dc=mycompany,dc=com
cn: admin
objectClass: organizationalRole
---
9. Try to ldapadd the base.ldif file:
ldapadd -x -W -f test_base.ldif
Enter LDAP Password:
adding new entry "cn=admin,dc=mycompany,dc=com"
ldap_add: Insufficient access
additional info: no write access to parent
ldif_record() = 50
Arrrgggh!
Ok so now I try adding the base.ldif file using slapadd. First slapadd
complained that there was not objectClass "top" defined in schema so I
changed the base.ldif file to look like:
---
dn: dc=mycompany,dc=com
dc: mycompany
objectClass: top
objectClass: dcObject
objectClass: organization
o: MIT Devin
dn: cn=admin,dc=mycompany,dc=com
cn: admin
objectClass: organizationalRole
---
10. slapadd -l base.ldif
No objectClass "top" defined in schema
slapadd: slap_schema_prep failed!
I give up. Can someone post some specific schema examples that will
work. The examples on the openldap site don't seem to work:
http://www.openldap.org/doc/admin/quickstart.html
Cheers.
Mark.
Reply to: