Reset the Directory Manager Password in 389 Directory Server

Reset or change the Directory Manager password in 389 Directory Server with online dsconf over LDAPS, offline pwdhash and dse.ldif editing, verification, rollback, and per-replica rollout.

Published

Updated

Read time 8 min read

Reviewed byDeepak Prasad

Reset the Directory Manager password in 389 Directory Server — online dsconf change, offline pwdhash and dse.ldif recovery, ldapwhoami verification, and replica rollout
Tested on Rocky Linux 10.2 (Red Quartz)
Package 389-ds-base 3.2.0-8.el10_2
Applies to RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora
Privilege sudo or root
Scope Reset or change the Directory Manager password online or offline. Covers verification, rollback, and per-replica rollout. Does not cover normal LDAP user passwords or replication credentials.
Related guides Install 389 Directory Server
dsconf commands
Fix LDAP invalid credentials error 49
Fix LDAP works but LDAPS fails
Password storage schemes

When cn=Directory Manager binds fail with invalid credentials, the recovery path depends on whether you still know the current password. When error 49 has causes beyond a wrong Directory Manager secret, start with fix invalid credentials.

IMPORTANT
This article covers the Directory Manager (nsslapd-rootpw) password only. It does not reset normal LDAP user passwords (manage users and groups), replication agreement credentials (replication agreements), or NSS database passwords used by TLS components.

Examples use instance ldap1 on ldap1.example.com with suffix dc=example,dc=com. Test against the individual server hostname rather than a load balancer when you verify a reset.


Determine whether to change or reset the password

Situation Correct method
Current password is known Change it online with dsconf over LDAPS
Password is forgotten Reset it offline through dse.ldif while the instance is stopped
Only a normal LDAP user is affected Use dsidm account reset_password
Only one replica rejects the password Reset that specific instance
Bind returns a RootDN access-control message Check RootDN Access Control before resetting

Directory Manager bypasses suffix ACIs. Ordinary ACIs cannot grant or remove its privileges. If binds are blocked by time, host, or IP rules, fixing RootDN Access Control may be required even after a successful password reset.


Confirm the instance and Directory Manager DN

List local instances before you touch configuration. Instance names and offline stop/start operations use dsctl:

bash
sudo dsctl -l

Sample output:

output
slapd-ldap1

The prefix before the instance name is slapd-. The short name ldap1 is what you pass to dsctl and dsconf.

Confirm the target instance is running:

bash
sudo dsctl ldap1 status

Sample output:

output
Instance "ldap1" is running

Read the configured root DN from the instance configuration file:

bash
sudo grep '^nsslapd-rootdn:' /etc/dirsrv/slapd-ldap1/dse.ldif

Sample output:

output
nsslapd-rootdn: cn=Directory Manager

The default root DN is cn=Directory Manager. Do not append the suffix.

Test the current credentials against the hostname you intend to manage:

bash
export LDAPTLS_CACERT=/etc/dirsrv/slapd-ldap1/ca.crt
ldapwhoami -x -H ldaps://ldap1.example.com:636 -D "cn=Directory Manager" -y /root/dm.pw

Sample output:

output
dn: cn=directory manager

A failed bind with the wrong password returns ldap_bind: Invalid credentials (49). Confirm you are testing the intended instance before you reset anything. A trailing newline inside a -y password file becomes part of the password and can cause false error 49 results.


Change the password when the current password is known

Change Directory Manager over an encrypted connection. The dedicated directory_manager password_change subcommand prompts for the current password, the new password, and confirmation without placing the new value in the written command.

On the Directory Server host, point the client at the instance CA certificate:

bash
export LDAPTLS_CACERT=/etc/dirsrv/slapd-ldap1/ca.crt
dsconf -D "cn=Directory Manager" ldaps://ldap1.example.com:636 directory_manager password_change

Sample prompts:

output
Enter password for cn=Directory Manager on ldaps://ldap1.example.com:636:
Enter new directory manager password :
CONFIRM - Enter new directory manager password :

Directory Server applies the change while the instance keeps running. Do not change this password over unencrypted ldap:// in production.

WARNING
Do not use curly braces in a plain-text Directory Manager password assigned through nsslapd-rootpw. Directory Server treats text inside braces as a storage-scheme prefix, which can make binds fail after an otherwise successful config replace. See password storage schemes for details.

A lower-level alternative is to replace nsslapd-rootpw directly over LDAPS. Directory Server hashes a plain-text value using the scheme in nsslapd-rootpwstoragescheme:

bash
export LDAPTLS_CACERT=/etc/dirsrv/slapd-ldap1/ca.crt
dsconf -D "cn=Directory Manager" -y /root/dm.pw ldaps://ldap1.example.com:636 config replace nsslapd-rootpw='NEW_DIRECTORY_MANAGER_PASSWORD'

Sample output:

output
Successfully replaced "nsslapd-rootpw"

Prefer directory_manager password_change when you want interactive prompts instead of placing the new password on the command line or in shell history. Verify the new password immediately before you close the administrative session that performed the change.


Reset a forgotten Directory Manager password offline

When the password is lost, generate a new hash with pwdhash, stop the instance, back up the stopped instance's dse.ldif, replace nsslapd-rootpw, and start the instance again.

Generate a hash with the instance storage scheme:

bash
sudo pwdhash -D /etc/dirsrv/slapd-ldap1 'NEW_DIRECTORY_MANAGER_PASSWORD'

Sample output:

output
{PBKDF2-SHA512}100000$KH1n7CMFpAfGU+sqrUNWBnvEux7eSj8+$Ixjr2vaOOakfVxu3Ah9jZuRnTEHNl/wYX6YbkeFq8A1kYvJ3sKcxM9kLa93hhJsC0N+FpADKvgiVgkWq+UlXcg==

Stop the instance before you edit dse.ldif. Manual changes made while the server is running can be overwritten:

bash
sudo dsctl ldap1 stop

Back up the stopped instance configuration:

bash
sudo cp -a /etc/dirsrv/slapd-ldap1/dse.ldif /etc/dirsrv/slapd-ldap1/dse.ldif.before-dm-reset

Open /etc/dirsrv/slapd-ldap1/dse.ldif and replace only the nsslapd-rootpw value. Copy the complete pwdhash output without deleting or inserting characters. A single physical line is valid:

text
nsslapd-rootpw: {PBKDF2-SHA512}100000$COMPLETE_HASH_VALUE

LDIF permits optional line folding. If you intentionally fold the value across multiple physical lines, begin every continuation line with one leading space so the LDIF parser joins the value correctly:

text
nsslapd-rootpw: {PBKDF2-SHA512}100000$FIRST_PART
 SECOND_PART
 THIRD_PART

Do not alter nsslapd-rootdn. Do not create duplicate nsslapd-rootpw attributes.

Start the instance:

bash
sudo dsctl ldap1 start

Sample output:

output
Instance "ldap1" has been started

If the instance fails to start, restore the backup shown in the troubleshooting section before you attempt another edit.


Verify the new password

After an online change or offline reset, confirm the bind with ldapwhoami before you rely on a stored password file. OpenLDAP reads the entire -y file, including a trailing newline, so an outdated or padded file can return error 49 even when the password change succeeded.

Commands that use /etc/dirsrv/slapd-ldap1/ca.crt run on the Directory Server host. From a remote administration host, set LDAPTLS_CACERT to the CA certificate installed on that client, such as /etc/pki/ca-trust/source/anchors/ds-ca.crt.

Prompt for the new password on the server host:

bash
LDAPTLS_CACERT=/etc/dirsrv/slapd-ldap1/ca.crt \
ldapwhoami -x \
  -H ldaps://ldap1.example.com:636 \
  -D "cn=Directory Manager" \
  -W

The same test from a remote administration host:

bash
LDAPTLS_CACERT=/etc/pki/ca-trust/source/anchors/ds-ca.crt \
ldapwhoami -x \
  -H ldaps://ldap1.example.com:636 \
  -D "cn=Directory Manager" \
  -W

Sample output:

output
dn: cn=directory manager

Update the stored password file on the administration host without adding a trailing newline:

bash
sudo bash -c '
umask 077
read -rsp "New Directory Manager password: " password
printf "%s" "$password" > /root/dm.pw
echo
'

Retest with the updated file:

bash
LDAPTLS_CACERT=/etc/dirsrv/slapd-ldap1/ca.crt \
ldapwhoami -x \
  -H ldaps://ldap1.example.com:636 \
  -D "cn=Directory Manager" \
  -y /root/dm.pw

Run a harmless configuration read with the updated file:

bash
dsconf -D "cn=Directory Manager" -y /root/dm.pw ldap1 config get nsslapd-rootdn

Sample output:

output
nsslapd-rootdn: cn=Directory Manager

Locate the latest Directory Manager bind in the access log:

bash
sudo grep 'BIND dn="cn=Directory Manager"' /var/log/dirsrv/slapd-ldap1/access | tail -1

Sample output:

output
[22/Jul/2026:10:10:31.826034033 +0530] conn=9 op=0 BIND dn="cn=Directory Manager" method=128 version=3

Search for the matching RESULT line using the same conn= and op= values from that bind:

bash
sudo grep 'conn=9 op=0 RESULT' /var/log/dirsrv/slapd-ldap1/access | tail -1

Sample output:

output
[22/Jul/2026:10:10:31.917364251 +0530] conn=9 op=0 RESULT err=0 tag=97 nentries=0 wtime=0.000740710 optime=0.091353699 etime=0.092088525 dn="cn=directory manager"

err=0 on the bind RESULT line confirms authentication succeeded only when the conn= and op= values match the preceding BIND record. On a busy server, unrelated nearby RESULT lines can also show err=0.


Troubleshoot a failed password reset

Check service state first:

bash
sudo dsctl ldap1 status

If the instance is not running, read the systemd journal:

bash
sudo journalctl -u dirsrv@ldap1 -n 20 --no-pager

Inspect the errors log for hash or configuration problems:

bash
sudo tail -n 20 /var/log/dirsrv/slapd-ldap1/errors

A truncated or malformed offline hash can produce messages similar to these when the copied value is incomplete rather than because Directory Server shortens every long single-line hash:

output
[22/Jul/2026:10:01:14.765351521 +0530] - ERR - plugins/pwdchan/src/lib.rs:181 - Invalid Base 64 TRUNCATEDONLY -> InvalidLength
[22/Jul/2026:10:01:14.775194149 +0530] - ERR - plugins/pwdchan/src/lib.rs:208 - invalid hashed pw -> InvalidBase64

When the server still starts but binds fail, restore the backup and return to a known-good configuration:

bash
sudo dsctl ldap1 stop
sudo cp -a /etc/dirsrv/slapd-ldap1/dse.ldif.before-dm-reset /etc/dirsrv/slapd-ldap1/dse.ldif
sudo dsctl ldap1 start
Symptom Likely cause Check
Current password is accepted but change fails Password syntax or insecure connection Use LDAPS and read the full dsconf error
New password returns error 49 Wrong instance, DN, incomplete hash, or stale password file Instance path, complete nsslapd-rootpw value, -W before updating -y file
Instance fails to start Invalid dse.ldif edit Errors log and backup file
Old password still works Wrong instance edited, or dse.ldif changed while running Instance path and restart requirement
Reset works on one replica only Password is local to each instance Reset and test each server hostname
ldapwhoami reports connection failure TLS or network problem Port, CA file, and LDAPS troubleshooting
Bind reports error 53 RootDN Access Control restriction Client IP, hostname, day, and time rules
Normal LDAP user cannot log in Wrong recovery procedure dsidm account reset_password
Replication still reports error 49 Replication bind account is different Agreement bind DN and stored password
Automated jobs fail after reset Stored secret is stale Backup jobs, monitoring, and dsconf -y files

Handle multiple instances and replication

Each 389 Directory Server instance keeps its own configuration tree:

text
/etc/dirsrv/slapd-<instance>/dse.ldif

Resetting ldap1 does not reset ldap2. Test each hostname directly. Perform the procedure separately on every instance that should use the new password.

The Directory Manager password is not the replication-agreement password. Changing it does not update application, backup, monitoring, or replication credentials automatically. After a reset, review dependent tools:

  • Administration scripts and cron jobs
  • Backup and restore utilities
  • Monitoring and health checks
  • LDAP browsers and IDE connectors
  • dsconf password files passed with -y
  • Secret stores outside Directory Server

In a replicated topology, plan the rollout instance by instance. Document which servers were updated and which clients still hold the previous secret.


References


Summary

Confirm the instance name and nsslapd-rootdn, then choose the online dsconf directory_manager password_change path when the current password is known or the offline pwdhash and dse.ldif path when it is forgotten. Stop the instance, back up dse.ldif, replace only nsslapd-rootpw, verify with -W before updating stored password files, and reset each replica independently. Update every stored secret that still references the old password.


Frequently Asked Questions

1. What is the difference between changing and resetting the Directory Manager password?

Change the password online with dsconf when you know the current secret. Reset it offline through dse.ldif when the password is forgotten. Normal directory users use dsidm account reset_password instead.

2. Can I paste a plain-text password into dse.ldif?

No. Offline recovery requires the hashed value from pwdhash -D aimed at the target instance configuration directory. Plain text in dse.ldif is a common reason binds fail after a manual edit.

3. Why does my pwdhash value fail after I paste it into dse.ldif?

Common causes are an incomplete hash copied from the terminal, a missing storage-scheme prefix, accidental spaces inside the value, incorrect continuation-line formatting when you intentionally fold the line, or editing the wrong instance dse.ldif. Copy the complete pwdhash output without deleting or inserting characters.

4. Does resetting Directory Manager on one replica update the others?

No. Each instance stores its own nsslapd-rootpw in /etc/dirsrv/slapd-INSTANCE/dse.ldif. Reset and test every server that should share the new password, and update backup jobs, monitoring tools, and dsconf password files separately.

5. Is the Directory Manager password the same as the replication bind password?

No. Replication agreements use their own bind DN and stored credential, often cn=replication manager,cn=config. A Directory Manager reset does not repair replication error 49 caused by a stale agreement password.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …