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