Linux: Force Users To Change Their Passwords Upon First Login

How can I force my Linux users to change their passwords upon the first login under CentOS / Debian Linux?

You can use any one of the following command to change user passwords upon the first login:

  • usermod command – Modify various user account properties including user password expiry information.


  • chage command – Change user password expiry information

Task: Use chage command to force users to chage their password upon first login

Use the following syntax: chage -d 0 <user-name>

chage -d 0 bubba

  • -d 0 : Set the number of days since January 1st, 1970 when the password was last changed. The date may also be expressed in the format YYYY-MM-DD. By setting it to zero, you are going to force user to change password upon first login.

Leave a Reply

Your email address will not be published. Required fields are marked *