System

Force users to change their passwords upon the first login

terminal bash shellWindows 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:

  1. Run the following command to lock the user account so it cannot log in. # usermod -L <username>
  2. 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>
  3. Finally, unlock the account with the command below. # usermod -U <username>
EOF.← Back to articles