我有一个由一组测试用户组成的LDIF文件,我想更改这些用户的密码。
我使用了ldapmodify
命令:
ldapmodify -c -a -f filename.ldif -h localhost -p <port> -D dn -w <pwd> << !
dn: uid=<userid>,dc=<branch>,DC=COM
changetype: modify
replace: userPassword
userPassword: <new pwd>
!
我收到以下错误:
ldap_sasl_interactive_bind_s: Can't contact LDAP server (-1)
答案 0 :(得分:11)
给定错误表示无法联系主机名和端口指定的服务器,即无法建立连接。此外,如果未指定ldapmodify
命令行选项,则旧版OpenLDAP -x
客户端默认为SASL绑定。
LDIF输入可以包含任意数量的要修改的条目,而不仅仅是一个:
dn: uid=abc,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: the-new-password
dn: uid=def,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: another-new-password
答案 1 :(得分:1)
ldapmodify -p 389 -D "" -w -a -c v -f pwd.ldif
pwd.ldif低于
dn: cn=config
changetype: modify
replace: root-dn-pwd
root-dn-pwd: xxxxxxx