Ldap – Delete domain using ldapdelete

ldapopenldap

According to the man page of ldapdelete it should be possible to delete entries

[root@controller ~]# man ldapdelete
EXAMPLE
       The following command:

           ldapdelete "cn=Delete Me,dc=example,dc=com"

       will  attempt  to  delete  the  entry  named   "cn=Delete   Me,dc=exam‐
       ple,dc=com".   Of  course  it  would  probably  be  necessary to supply
       authentication credentials.

but deleting a domain does not work:

[root@controller ~]# ldapdelete -x -D "cn=Manager,dc=my-domain,dc=com" -W "dc=my-domain,dc=com"
Enter LDAP Password:
ldap_delete: No such object (32)

while it exists

[root@controller ~]# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#

#
dn:
namingContexts: dc=my-domain,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

Best Answer

Even deleting the base entry will not remove a naming context. You'll have to remove it from your configuration.