Force a user to change password upon first login

This is how you can force a Redhat user to change his password upon first login on a Redhat 5 installation. This might work on other versions and distributions…

  1. First lock the account to prevent the user from logging in until the change has been made
# usermod -L <username>
  1. Change the password expiration date to 0 to ensure the user changes the password during the next login attempt
# chage -d 0 <username>
  1. To unlock the account after the change do the following:
# usermod -U <username>