Pages

Linux: Force Users To Change Their Passwords Upon First Login


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


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

[a] usermod command - Modify various user account properties including user password expiry information.
Where,

[b] 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 tom


  • -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.

Further readings:


  • man pages usermod and chage