10

我有一个包含一组测试用户的 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)
  1. 这是什么意思?
  2. 我使用的语法只能用于一个用户,我想修改我的 LDIF 文件中所有测试用户的密码。有没有办法这样做?
4

2 回答 2

14

给定的错误表明无法联系主机名和端口指定的服务器,即无法建立连接。此外,如果未指定命令行选项,旧版 OpenLDAPldapmodify客户端默认为 SASL 绑定。-x

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

也可以看看

于 2012-06-14T17:52:36.553 回答
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
于 2013-12-10T04:56:20.050 回答