I have a LDIF file that consists of a set of test users and I would like to change the passwords for these users.
I used the ldapmodify
command:
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>
!
And I get the following error:
ldap_sasl_interactive_bind_s: Can't contact LDAP server (-1)
The given error is an indication that the server specified by the hostname and port could not be contacted, that is, a connection could not be established. Also, the legacy OpenLDAP ldapmodify
client defaults to a SASL bind when the -x
command line option is not specified.
The LDIF input can contain any number of entries to be modified, not just one:
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