Change password using LDIF file
Asked Answered
R

1

10

I have an LDIF file that contains a bunch of test users.

I would like to change the password for some of these users and was wondering what would be the best way to do so.

Ruralize answered 11/5, 2012 at 14:13 Comment(0)
V
12

Use ldapmodify with LDIF, for example:

ldapmodify -h hostname -p port -D dn -w password <<!
dn: uid=user,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: new-password
!

or specify a filename:

ldapmodify -c -a -f file.ldif -h hostname -p port -D dn -w password

Of course, use the correct attribute names, distinguished names, and so forth. The distinguished name used for the bind of the ldapmodify tool must have access rights to modify the password of the distinguished name specified in the LDIF.

see also

Veranda answered 11/5, 2012 at 14:28 Comment(2)
Should that exclamation point be there at the end of the sample ldapmodify command?Pyotr
Notice that if you specify a password in plain text it will be stored in plain text (Base64 encoded). If you are using OpenLDAP consider to use the slappasswd command for generating hashed password.Fluoride

© 2022 - 2024 — McMap. All rights reserved.