How to use passwd command In Linux
To force a user to change the user account password, the current password must have expired. We can expire the password of the user using `passwd` command. `passwd` command provides `-e` or `–expire` option to expire the password of the user. Use the following command to expire the password of the user.
sudo passwd --expire username
After executing this command, the password will expire. We can check if the password expired or not using the `chage` command with `-l` option. Use the following command to verify password expired or not.
sudo schag -l username
Next time when a user tries to log in to the system the user is prompted to change the current password.
How to Force User to Change Password at Next Login in Linux
For security reasons, you must frequently change the password of accounts on the system. In this article, we are going to see how we can force the user to change the password on the next login in Linux. We can do that by two methods, one is using `passwd` command and the other is by using the `chage` command.