Users
The chage command
Views and changes when a password expires and how often it must be renewed.
Most useful options
-l, --listShows the expiry information. Without root, only that of your own account-M, --maxdays <días>Maximum days the password is valid. With -1 the check is no longer made-m, --mindays <días>Minimum days between two password changes. With 0, it can be changed at any time-W, --warndays <días>Days of warning before the password expires-I, --inactive <días>Days of inactivity, after the password expires, before the account is locked. With -1 it is removed-E, --expiredate <fecha>Date on which the account stops being accessible, whatever the password. With -1 or an empty string it is removed-d, --lastday <fecha>Sets the date of the last change. With 0 it forces a change at the next login-i, --iso8601Shows dates in YYYY-MM-DD formatCopy-ready examples
$ sudo chage -l alumnoshows the expiry policy of the alumno account.Example output
Last password change : Nov 03, 2026 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
$ sudo chage -M 90 alumnoforces the password to be renewed every 90 days.$ sudo chage -W 7 -M 90 alumnothe same, warning seven days before it expires.$ sudo chage -E 2027-06-30 alumnothe account stops being accessible from that date on.$ sudo chage -d 0 alumnoforces a password change at the next login.You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| chage: Permission denied. | Without root you can only change expiry data or view another account, and chage -l without root shows only yours. | Run the command again with sudo in front, for example sudo chage -l alumno. |
| chage: invalid numeric argument 'treinta' | The value of -M, -m, -W or -I must be a whole number of days, not text. | Write the number of days, for example -M 90. |
| chage: invalid date 'mañana' | The date given to -E or -d is not in YYYY-MM-DD format nor a number of days since 1970-01-01. | Use 2027-06-30, or compute a date with sudo chage -E $(date -d +180days +%F), as in the manual. |
Typical mistakes
- Changing -M does not force a password change right away. It is required once the date of the last change plus those days has passed.
- chage only reads /etc/shadow. Accounts managed from LDAP or another source do not show their real data in the output.
- A user without root can only use -l, and only on their own account.
Differences from similar commands
- passwd: changes the password itself. chage does not change it: it sets when it expires and how often it must be renewed.
- usermod: with -e it sets when the account is disabled, just like chage -E. usermod does not set password ageing; chage does.
- getent: shows account data, but raw and with days since 1970. chage translates them into dates.
FAQ
What happens if the password expires and nobody changes it?
With -I, the account is locked after those days of inactivity. A locked user has to ask the administrator to reactivate it.
How do I make the account expire in 180 days?
With sudo chage -E $(date -d +180days +%F) user, the form shown in the manual. Use -1 to remove the date.
What date format does it accept?
YYYY-MM-DD, or a number of days since 1 January 1970. Dates are read in UTC. With -i, chage displays them as YYYY-MM-DD.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course