When Tried to Do ldapadd got this error ldap_add: No such object (32)

I have Following Entries in my slapd.conf

#######################################################################
# ldbm and/or bdb database definitions
#######################################################################
#backend        hdb
database    bdb
suffix      "dc=example,dc=com"
checkpoint  1024 15
rootdn      "cn=Manager,dc=example,dc=com"
rootpw      {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
directory   /var/lib/ldap
index objectClass   eq,pres


######################################################################

database monitor

access to *
        by dn.exact="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
        by dn.exact="cn=Manager,dc=example,dc=com" read
        by * none

When i try to write following command

ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f ldapuser100.ldif

I got following error:

adding new entry "uid=ldapuser100,ou=People,dc=example,dc=com"
ldap_add: No such object (32)

Following is the debug:

oc_check_allowed type "structuralObjectClass"
bdb_dn2entry("uid=ldapuser100,ou=people,dc=example,dc=com")
=> bdb_dn2id("dc=example,dc=com")
<= bdb_dn2id: get failed: DB_NOTFOUND: No matching key/data pair found (-30988)
bdb_add: parent does not exist
 send_ldap_result: conn=1 op=1 p=3
send_ldap_response: msgid=2 tag=105 err=32
ber_flush2: 22 bytes to sd 12
conn=1 op=1 RESULT tag=105 err=32 text=
connection_get(12): got connid=1
connection_read(12): checking for input on id=1
ber_get_next
ber_get_next: tag 0x30 len 5 contents:
op tag 0x42, time 1379789891
ber_get_next
conn=1 op=2 do_unbind
conn=1 op=2 UNBIND
connection_close: conn=1 sd=12
conn=1 fd=12 closed

Contents of my LDIF file:

dn: uid=ldapuser100,ou=People,dc=example,dc=com
uid: ldapuser100
cn: ldapuser100
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}xxxxxxxxxxxxxxxxxxxxxxx
shadowLastChange: 15969
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1400
gidNumber: 1400
homeDirectory: /exports/ldapuser100

What should i do now?


The contents of the LDIF file have to be sensitive to your directory. It looks (though you haven't posted what is in the ldif file, so I really can't tell what you are trying to do) as though you are trying to add a user within ou=People,dc=example,dc=com, but either ou=People doesn't exist, or your directory's base DN somehow doesn't exist. Try adding the People OU to your base, and add this LDIF again.

Also, generally, posting your password hashes to the Internet is not the best of ideas.

Occasionally this problem is also a result of being unable to open the backend BDB database, though usually some indication of this will be given in the debug output.

You may need to import more things first though.

Like your base DN:

dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: ExmapleCo

You might be able to omit objectClass=organization and o=ExampleCo (I honestly forget).

Also, your OU:

dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People