We can force the user to change their password at first login in Linux and can set a password using passwd command. There is a way to force the user to change their password at first login to the system. This can be done with the ‘–d‘ option.
chage command used to configure a password expiry from the shell prompt followed by many options available.
Force User To Change At first log in:
You can manage user password policy using the below command to force.
The syntax is chage –d 0 username
We have created a user with a test and password.
Now, run the below command to force the user.
chage –d 0 test
After this command user will have to change the password at first login. You can also use the ‘-e‘ option as well.
After putting an old password it will jump to ask you to change the current password as shown in the figure.
Finally, the password changed.
That’s it. passwd force user change password linu change user password linux