Saturday, November 6, 2010

Reset password while system uses both local & ldap accounts

In a machine where the user authentication is depending on both local /etc/passwd file and ldap, reset of local password should be done as below.

(Server1:/)# passwd petuser
New Password:
Re-enter new Password:
Permission denied

(Server1:/)# id
uid=0(root) gid=0(root)
(Server1:/)#

This happens because the user account authentication involves both ldap and files.

(Server1:/)# ps -ef | grep ldap
    root  2925  2430   0   Oct 27 ?           0:47 /usr/lib/ldap/ldap_cachemgr
    root 12024 22230   0 13:57:15 pts/1       0:00 grep ldap

(Server1:/)# passwd -help
usage:
        passwd [-r files | -r nis | -r nisplus | -r ldap] [name]
        passwd [-r files] [-egh] [name]
        passwd [-r files] -sa
        passwd [-r files] -s [name]
        passwd [-r files] [-d|-l|-N|-u] [-f] [-n min] [-w warn] [-x max] name
        passwd -r nis [-eg] [name]
        passwd -r nisplus [-egh] [-D domainname] [name]
        passwd -r nisplus -sa
        passwd -r nisplus [-D domainname] -s [name]
        passwd -r nisplus [-D domainname] [-l|-N|-u] [-f] [-n min] [-w warn]
                [-x max] name
        passwd -r ldap [-egh] [name]
        passwd -r ldap -sa
        passwd -r ldap -s [name]
        passwd -r ldap [-l|-N|-u] [-f] [-n min] [-w warn] [-x max] name
Invalid combination of options

So use -r option with passwd command to reset the local password.

(Server1:/)# passwd -r files petuser
New Password:
Re-enter new Password:
passwd: password successfully changed for petuser

No comments:

Post a Comment