18 lines
755 B
Plaintext
18 lines
755 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
uid="$1"
|
||
|
|
||
|
if [ -z "$uid" ]; then
|
||
|
echo "Need a user ID (uid)!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
ldappasswd -D 'cn=root,dc=aninix,dc=net' -y /root/.ldappass "uid=$uid,ou=People,dc=aninix,dc=net"
|
||
|
|
||
|
if [ `ldapsearch -x "(uid=$uid)" + \* | grep -c shadowLastChange\:` -ne 0 ]; then
|
||
|
(printf "dn: uid=$uid,ou=People,dc=aninix,dc=net\nchangetype: modify\ndelete: shadowLastChange\n\n") | ldapmodify -D 'cn=root,dc=aninix,dc=net' -y /root/.ldappass &>/dev/null;
|
||
|
fi
|
||
|
(printf "dn: uid=$uid,ou=People,dc=aninix,dc=net\nchangetype: modify\nadd: shadowLastChange\nshadowLastChange: 0\n\ndn: uid=$uid,ou=People,dc=aninix,dc=net\nchangetype: modify\nadd: pwdReset\npwdReset: TRUE\n\n") | ldapmodify -D 'cn=root,dc=aninix,dc=net' -y /root/.ldappass &>/dev/null;
|
||
|
|
||
|
exit $?
|