How to remove all records from LDAP?

Viewed 10309

Is it possible to remove all entries from LDAP by one-line commend?

I tried:

ldapdelete -r 'cn=*,dc=domain,dc=com' -w

but it's not working. I have no better ideas;/

2 Answers

With the HDB backend

You can try this approach: go to the /var/lib/ldap directory and run this command:

sudo rm __db.* *.bdb log.*

The slapd server should preferably be shutdown before running this command.

Make sure you have a backup of the files before executing this

With the MDB backend

Similar as the above, but the file names are different:

sudo rm *.mdb
Related