force password change

Scott Ruckh sruckh at gemneye.org
Wed Jul 26 00:37:43 UTC 2006


This is what you said Greg Wiggill
> Hi All,
>
> I see where changing PASS_MAX_DAYS  in /etc/login.defs ONLY affects new
> user accounts ?
>
> Any easy way to force existing users to change their password ?
>
>
Short Answer:

chage -d 0

Long Answer:

usermod -L username

chage -d 0 username

Now comes the fun part...

You now have two choices.

A) reset account to use NULL password.  In this case user will
automatically be prompted to change password by just entering username. 
This may not be the best option because any user could type in the
username and reset the password.  Only use this option if you are
immediatly going to call user and have them change password right away.

usermod -p "" username

B) create an initial password for user.

goto python interpreter by typing python at shell prompt.

type the following:

import crypt; print crypt.crypt("password","salt")

where password is the initial password you want to use.

you will be returned an encrypted password (copy or write down this
information)

type CTRL-d to get out of python interpreter.

next type the following

usermod -p "encrypted password" username

where encrypted password is the text you copied from above.

All done.




More information about the redhat-list mailing list