32 lines
666 B
Bash
Executable File
32 lines
666 B
Bash
Executable File
#!/bin/bash
|
|
|
|
uid="$1"
|
|
|
|
if [ -z "$uid" ]; then
|
|
echo "Need a user ID (uid)!"
|
|
exit 1
|
|
fi
|
|
|
|
read -sp 'cn=root,dc=aninix,dc=net Password: ' rootdnpw
|
|
|
|
ldappasswd -D 'cn=root,dc=aninix,dc=net' -w "$rootdnpw" -H ldap://127.0.0.1 "uid=$uid,ou=People,dc=aninix,dc=net" && \
|
|
ldapmodify -D 'cn=root,dc=aninix,dc=net' -w "$rootdnpw" -H ldap://127.0.0.1 -f <(cat <<EOM
|
|
dn: uid=$uid,ou=People,dc=aninix,dc=net
|
|
changetype: modify
|
|
add: pwdReset
|
|
pwdReset: TRUE
|
|
|
|
|
|
EOM
|
|
)
|
|
|
|
echo 'As cn=root,cn=config...' && ldapmodify -D 'cn=root,cn=config' -W -H ldap://127.0.0.1 -f <(cat <<EOM
|
|
dn: uid=$uid,ou=People,dc=aninix,dc=net
|
|
changetype: modify
|
|
delete: pwdChangedTime
|
|
|
|
|
|
EOM
|
|
)
|
|
exit $?
|