Backup LDAP entries with ldapsearch

       84 words, 1 minutes

I have a LDAP instance running the OpenBSD’s ldapd. I installed the openldap-client package so that I get ldapsearch, but there doesn’t seem to be any slapcat-like tool ; which may be used to backup the LDAP content in LDIF format.

Here’s a trick to dump the ldapd content using ldapsearch:

# ldapsearch -x -H ldaps://ldap.tumfatig.net -D "cn=admin,dc=tumfatig,dc=net" -W -b "dc=tumfatig,dc=net" -LLL > ldapd-"`date +%Y%m%d`".ldif

This generates a file in LDIF format which can be used by ldapadd to fill another LDAP instance.
W00t!