2023-02-20 16:50:10 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
uid="$1"
|
|
|
|
|
|
|
|
if [ -z "$uid" ]; then
|
|
|
|
echo "Need a user ID (uid)!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-09-02 23:54:57 -05:00
|
|
|
read -sp 'cn=root,dc=aninix,dc=net Password: ' rootdnpw
|
2023-02-20 16:50:10 -06:00
|
|
|
|
2024-09-02 23:54:57 -05:00
|
|
|
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
|
2023-02-20 16:50:10 -06:00
|
|
|
|
2024-09-02 23:54:57 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
)
|
2023-02-20 16:50:10 -06:00
|
|
|
exit $?
|