I'm running an openLDAP server version 2.4.40 on CentOS 7. LDAP is going to be configured using online conf option (olc). Thanks to this question, I know that slapd's database files are in /var/lib/ldap
.
I'm trying to run an openLDAP server on a linux box as read-only OS partition and another partition for persistent data. I will be able to install and configure openLDAP on the OS partition, but will lose access to it after configuring it.
Question: Is it possible to change the location LDAP reads/writes data from /var/lib/ldap to somewhere on the persistent data partition?
Best Answer
I used to move the default database of openldap after each new setup.
The steps I do when I want to move a database :
slapd
slapcat
the content of thecn=config
branch in a LDIF file/var/lib/ldap
directory wherever you want itopenldap
owns the new directory and all the files insideolcDbDirectory
to the new location/etc/ldap/slapd.d
is empty before doing this)/etc/ldap/slapd.d
and all its content is owned byopenldap
For example, with
apparmor
, edit the file/etc/apparmor.d/usr.sbin.slapd
and add the following lines:Usually it does the trick. It's also how I backup the configuration of my openldap instances.