Force users to change their passwords upon the first login
Windows can be set to require a new password at login. Linux can do the same, though the procedure is slightly more involved: three commands make users change their passwords immediately when they log in.
To require a password change at login, follow these steps:
- Run the following command to lock the user account so it cannot log in.
# usermod -L <username> - Run the following command to set the password age to 0 days, forcing the user to change the password at the next login.
# chage -d 0 <username> - Finally, unlock the account with the command below.
# usermod -U <username>