Changing passwords in an LDIF file using the ldapmodify command

I have an 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) 
  • What does it mean?
  • The syntax that I used can only be used for one user, I would like to change the passwords of all test users in my LDIF file. Is there any way to do this?
+8
ldap ldif
source share
2 answers

This error is an indication that the server specified with the host name and port cannot be contacted, i.e. connection could not be established. In addition, the legacy OpenLDAP ldapmodify client is bound to the SASL binding by default if the -x command-line option is not specified.

An LDIF input can contain any number of entries to modify, and 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 

see also

+11
source share
 ldapmodify -p 389 -D "" -w -a -cv -f pwd.ldif 

pwd.ldif below

 dn: cn=config changetype: modify replace: root-dn-pwd root-dn-pwd: xxxxxxx 
+1
source share

All Articles