#!/bin/sh ## ## apacheds-passwd.sh -- change the ApacheDS "admin" password ## # command line argument if [ $# -ne 2 ]; then echo "USAGE: apacheds-password " 1>&2 exit 1 fi password_old="$1" password_new="$2" # make sure OpenLDAP ldapmodify(1) is available if [ ! -x @l_prefix@/bin/ldapmodify ]; then echo "$0:ERROR: sorry, automatic modification of the ApacheDS \"admin\" password" 1>&2 echo "$0:ERRRO: requires the OpenLDAP ldapmodify(1) client utility to be available." 1>&2 exit 1 fi # change password in database by preparing an LDIF file # which is loading and removed on server startup ( echo "dn: uid=admin,ou=system" echo "changetype: modify" echo "replace: userPassword" echo "userPassword: $password_new" ) | @l_prefix@/bin/ldapmodify \ -h 127.0.0.1 -p 10389 \ -D uid=admin,ou=system \ -x -w "$password_old"