how do you set the admin password on openldap 2.4

This is old, but the question and non-answer pop up on searches a lot. First, run slappasswd to generate a password.

slappasswd 
New password: ************
Re-enter new password: *************
{SSHA}OM5mbC3/kQPAg8MH6FOqXkATjLjt2IZ2

Then use that value to populate your backend's config.

ldapmodify -Q -Y EXTERNAL -H ldapi:/// << E0F
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}qUoTRPwppaedqHQTgYOPYWokr3SiXjbK
E0F

Your dn may be different than the dn shown here. The config databases are found, on RHEL7, in /etc/openldap/slapd.d/cn=config. Now you can log in using the default rootdn.

If you wish, you can set your own value for the root dn:

ldapmodify -Q -Y EXTERNAL -H ldapi:/// << E0F
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=manager,dc=example,dc=com
E0F

Tags:

Linux

Openldap