← Users & Permissions
Linux · Users & Permissions
How to change a user password and expiry in Linux
Set a user password, force a change at next login, and configure password aging with passwd and chage.
Set or reset a password and control password aging. Run as root to change another user password.
Changing another user password or forcing expiry locks them out until they set a new one. Make sure you are acting on the right account.
# Set / reset a password
sudo passwd <user>
# Force a password change at next login
sudo passwd -e <user>
# Expire the password after 90 days, warn 7 days before
sudo chage -M 90 -W 7 <user>
# Show the resulting aging settings
sudo chage -l <user>Linuxpasswdchage