[Sussex] change password

Steven Dobson steve at dobson.org
Sun Jul 30 21:22:28 UTC 2006


Desmond

On Sun, 2006-07-30 at 21:14 +0100, Desmond Armstrong wrote:
> I am having to change the password for a user and although working as 
> root, for some reason I am unable to change it, it reverts back again. 
> Which is the file that needs to be changed, where are the passwords stored?

First, please be aware the system does not store the users' passwords in
plain (clear) text.  They are hashed.  When you type in your password at
login, it is hashed in the same way and the result compaired with the
password hash stored.  If they are the same then it is assumed that you
typed the same password and you're let in.

However, the hash used has been carefully worked out so it is not
possible to determine the password given that you know the hash.
Because of this it is not possible to edit the file where the password
is stored and change it.  You _must_ used the passwd(1) command.

In the olden days the passwords where stored in the /etc/passwd file
along with other user settings (like thier real name, their home
directory an their default shell).  The /etc/passwd file needs to be
world readable so various utilities can get access to the user settings.
Storing passwords in the file is a security risk, so some years ago they
where moved out and placed in a separate file: /etc/shadow.  This file
should not be world readable.

On my system every things works fine.  the passwd command changes the
password for my default user without a problem.  You may also what to
check /var/log/auth.log with is where the changes are logged.  It might
give you a clue as to why the passwords are not being changed on your
system.

    # passwd steve
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully

    # ls -l /etc/passwd /etc/shadow
    -rw-r--r-- 1 root root   1335 Jul 30 00:25 /etc/passwd
    -rw-r----- 1 root shadow  966 Jul 30 22:10 /etc/shadow

    # tail /var/log/auth.log
    Jul 30 22:10 passwd[1035]: (pam_unix) password changed for steve
    Jul 30 22:10 passwd[1035]: (pam_unix) Password for steve was changed

Steve

(Note: I've had to edit the log lines down a little so they would fit on
a line).





More information about the Sussex mailing list