How To Force User Change Password At Next Login on Linux

Posted by Planet Malaysia on September 11, 2008

advertisement

My previous post talked about How To Show Linux User Password Expires. I would like to share “How to force user change password at next login on Linux“.

Option 1:
passwd command – change user password
Use the following syntax:
passwd -e

  • -e Force the user to change password at next login

Setting password expire for user test

planetmy:~ # passwd -e test
planetmy:~ # chage -l test
Minimum: 0
Maximum: 90
Warning: 7
Inactive: -1
Last Change: Unknown, password is forced to change at next login
Password Expires: Never
Password Inactive: Never
Account Expires: Sep 11, 2008

Login as user ‘test’
login as: test
Using keyboard-interactive authentication.
Password:
Using keyboard-interactive authentication.
Password change requested. Choose a new password.
Old Password:
Using keyboard-interactive authentication.
New Password:
Using keyboard-interactive authentication.
Reenter New Password:
Last login: Thu Sep 11 10:13:22 2008 from 192.168.1.102
test@planetmy:/>

Note: This is apply to SuSE Linux 9 and 10 but NOT Red Hat Linux.

Option 2:
chage command – change user password expiry information
Use the following syntax:

planetmy:~ # chage -d 0 test

  • -d, –lastday lastday
    With this option the date when the password was last changed can be set to another value. lastday has to be specified as number of days since January 1st, 1970. The date may also be expressed in the format YYYY-MM-DD. If supported by the system, a value of zero forces the user to change the password at next login.

For more information, please refer to man chage and man passwd.

Possibly Related Posts:


Comments

One Response to “How To Force User Change Password At Next Login on Linux”

  1. Frank on January 20th, 2009 11:33 am

    hi i want to ask this question

    force temporary users on the system to expire in 90 days from the creation day.

Leave a Reply




Planet Malaysia

  • Follow us on Twitter


  • web www.planetmy.com