Created
February 18, 2015 19:30
-
-
Save dnozay/d28dff75c390ebba7ded to your computer and use it in GitHub Desktop.
change slapd manager password.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# License: MIT | |
# You can find a copy of the license here: http://opensource.org/licenses/MIT | |
# This simple script lets you change the LDAP admin password from | |
# a console on the LDAP server. | |
cd /tmp | |
set -o errexit | |
PASSWORD=$(slappasswd -h {SSHA}) | |
echo "New hashed password is $PASSWORD" | |
cat > ./new-password.ldif <<EOFLDIF | |
dn: olcDatabase={1}hdb,cn=config | |
changetype: modify | |
replace: olcRootPW | |
olcRootPW: ${PASSWORD} | |
EOFLDIF | |
echo "New password LDIF is:" | |
cat ./new-password.ldif | |
echo "" | |
read -p "Proceed to change password [y/N] " -N 1 -s | |
echo "" | |
if test "${REPLY}" == "y"; then | |
echo Performing change... | |
ldapmodify -Y EXTERNAL -H ldapi:/// -f ./new-password.ldif | |
else | |
echo Not performing change... | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment