How to reset the Open Directory administrator password

This will require slot ID for the Open Directory administrator user, so the first goal will be to extract the slot ID from the directory. The second part deals with changing the administrator password, for which you will need local administrator privileges on the server and access to the server via an interactive shell, such as the Terminal or ssh.

Extracting the slot ID using Terminal

Log into the server using a local administrator user account, and open Terminal.

Execute this command:

sudo mkpassdb -dump

Enter your administrator password when prompted.

A list of user shortnames with corresponding slot ID’s will be listed.

Find the <slot ID> which will be located to the left of the directory administrators shortname. The ID starts with 0x and ends before the user’s shortname example:

"slot 002: 0x479e48fe68b4567000000002000000002		diradmin 03/11/2008 02:12:30 PM"

Copy the value for later use.

Resetting the Open Directory administrator password

Log into the server using a local administrator user account, and open the Terminal.

Enter this command:

sudo su

Enter your administrator password when prompted.

Enter the following command:

mkpassdb -setpassword slot-ID 

Replace <slot ID> with the value obtained earlier. You will be prompted for the new directory administrator password.

IMPORTANT: At this point, you have root privileges in this session. To avoid potential damages to the system in case of a mistake, be sure to quit the Terminal application now.