# how to change LDAP user password?



## meta (Oct 14, 2009)

Hi.

My systems (7.2R and 8RC) are set to use LDAP information to log in.
Users can login to the system with SSH, IMAP, NX, and other methods
but they cannot change their own password with passwd command.


```
[meta@rose ~]$ passwd
passwd: Sorry, `passwd' can only change passwords for local or NIS users.
```

I want to do following 2 things.

1. Make it possible to users to change their own password.
2. To change(reset) user's password for whom forgotten his password with root privileges.


----------



## emka81 (Jun 2, 2010)

Good night,

maybe there is an answer half a year ago ? I am standing for exactly the same problem. How do you guys change your passwords ?

i read about that thing in http://www.freebsd.org/doc/en/articles/ldap-auth/client.html

but that script is not working ... 

```
#!/bin/sh

stty -echo
read -p "Old Password: " oldp; echo
read -p "New Password: " np1; echo
read -p "Retype New Password: " np2; echo
stty echo

if [ "$np1" != "$np2" ]; then
  echo "Passwords do not match."
  exit 1
fi

ldappasswd -D uid="$USER",ou=people,dc=example,dc=org \
  -w "$oldp" \
  -a "$oldp" \
  -s "$np1"
```

and the answer

```
Old Password: 
New Password: 
Retype New Password: 
ldap_bind: Invalid credentials (49)
```

sure i changed the script on my own things, like cn="$USER",cn=lehrer, ou=leute,dc=example,dc=local

i hope you can help me

regards, Martin


----------

