Skip to content

Instantly share code, notes, and snippets.

@AloPress
Last active April 10, 2019 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AloPress/3ea161a2b11dc2a2d0bbeb30702e5144 to your computer and use it in GitHub Desktop.
Save AloPress/3ea161a2b11dc2a2d0bbeb30702e5144 to your computer and use it in GitHub Desktop.
A simple way to fix Open Directory via terminal. Source: http://automatica.com.au/2016/01/fix-a-broken-open-directory/

Fixing the Open Directory via macOS terminal.

sudo launchctl unload /System/Library/LaunchDaemons/org.openldap.slapd.plist
sudo /usr/libexec/slapd -Tt
sudo db_recover -cv -h /var/db/openldap/openldap-data/
sudo db_recover -cv -h /var/db/openldap/authdata/
sudo /usr/libexec/slapd -Tt
sudo launchctl load /System/Library/LaunchDaemons/org.openldap.slapd.plist

If this sequence of commands doesn’t fix it, then you will need to restore the LDAP databases from backup, which can generally be done with the following command:

sudo slapconfig -restoredb /private/var/backups/ServerBackup_OpenDirectoryMaster.sparseimage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment