Force linux user to change password upon login
In this tutorial we will learn how to force linux user to change the password upon login. There are two commands through which we can force user to change password upon first login or login.You can use any of the either command.
Note: Login as root to run these commands. If non-root user have sudo access then use sudo before these commands.
eg. sudo chage -d 0 user_name
OR sudo passwd -e user_name
Command 1: By using chage
command
Syntax:
chage -d 0 user_name
Example: Here the user name is sharad
chage -d 0 sharad
Command 2: You can also use passwd
command
Syntax:
passwd -e user_name
Example: Here the user name is sharad
passwd -e sharad
After running any of the above given two commands.Logout and then login with user.On giving login password it will ask to reset new password.First give old password then give new password and reconfirm new password.(As per the message you will see on terminal or console)