我正在尝试为用户重置密码过期时间(实际上为此设置了一个半自动化流程),这让我很伤心:
服务器是 openldap slapd:2.4.28-1.1ubuntu4.2
$ ldapsearch -x -b dc=internal,dc=brazzers,dc=com uid=jenna sambaPwdLastSet sambaPwdMustChange
# jenna, People, internal.brazzers.com
dn: uid=jenna,ou=People,dc=internal,dc=brazzers,dc=com
sambaPwdLastSet: 1395420463
sambaPwdMustChange: 1398098896
测试输出:
$ cat <<EOF
dn: uid=jenna,ou=People,dc=internal,dc=brazzers,dc=com
changetype: modify
replace: sambaPwdLastSet
sambaPwdLastSet: $(date -u +%s)
-
replace: sambaPwdMustChange
sambaPwdMustChange: $(date -u -d "+1 month" +%s)
-
EOF
结果是:
dn: uid=jenna,ou=People,dc=internal,dc=brazzers,dc=com
changetype: modify
replace: sambaPwdLastSet
sambaPwdLastSet: 1395421165
-
replace: sambaPwdMustChange
sambaPwdMustChange: 1398099565
-
好的,让我们这样做:
$ cat <<EOF | ldapmodify -D cn=admin,dc=internal,dc=brazzers,dc=com -W
dn: uid=jenna,ou=People,dc=internal,dc=brazzers,dc=com
changetype: modify
replace: sambaPwdLastSet
sambaPwdLastSet: $(date -u +%s)
-
replace: sambaPwdMustChange
sambaPwdMustChange: $(date -u -d "+1 month" +%s)
-
EOF
Enter LDAP Password:
ldapmodify: wrong attributeType at line 4, entry "uid=jenna,ou=People,dc=internal,dc=brazzers,dc=com"
啥?怎么会错呢?