Want to change your ldap password(even more?) with ldapmodify? Here goes the steps:
1. Use ldapsearch to get a glance at the account that needs password reset:
[root@doxer ~]# ldapsearch -LLL -b ‘ou=people,dc=doxer,dc=org’ -x -ZZ -H ‘ldap://doxer.org’ -w ‘password’ -D ‘cn=Manager,dc=doxer,dc=org’ uid=liandy
dn: uid=liandy,ou=people,dc=doxer,dc=org
userPassword:: e1NTSEF9WGdafd3M4RjhuSSdadfdDVmTjAwN3B6cVlacjQ0N23/12/2011fag
shadowLastChange: 15347
gidNumber: 3000
uid: liandy
cn: liandy
homeDirectory: /home/liandy
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
uidNumber: 250142da
gecos: liandy
loginShell: /bin/ksh
shadowFlag: 0
NB: -LLL here, you can refer to http://www.linuxmanpages.com/man1/ldapsearch.1.php. Here’s the excerpt:
-LSearch results are display in LDAP Data Interchange Format detailed in ldif(5). A single -L restricts the output to LDIFv1. A second -L disables comments. A third -L disables printing of the LDIF version. The default is to use an extended version of LDIF.
2.Now let’s use ldapmodify to change the password:
[root@doxer ~]ldapmodify -H ‘ldap://doxer.org’ -D ‘cn=Manager,dc=bskyb,dc=com’ -w ‘password’ -f /tmp/liandy.ldif
This is the content of /tmp/liandy.ldif
dn: uid=liandy,ou=people,dc=doxer,dc=org
changetype: modify
replace:userPassword
userPassword:newpassword
3.To confirm:
[root@doxer ~] ldapsearch -x -W -D ‘cn=Manager,dc=bskyb,dc=com’ -h ‘ldap://doxer.org’ -b ‘ou=people,dc=doxer,dc=org’ cn=liandy modifytimestamp modifiersname
Now you can test the work by log on with new password!
NB: For more about ldapmodify, please refer to https://www.opends.org/wiki/page/Ldapmodify(multi modification in one CMD etc.)