我正在尝试为用户重置密码到期(实际上为此设置了一个半自动过程),这让我哭了:
服务器是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"
什么?怎么可能是错的?
啊!尾随空格的又一次攻击!
我有一个尾随空格,
replace: sambaPwdLastSet
就像:使用 ldapadd 时出现“错误的属性类型”