brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: chage -l shows when an account's password or login expires

Linux
~/tips/tip-security-chage-l-password-aging

chage -l jordi

Lists the password aging and expiry details of a user account.

An account that suddenly cannot log in, or a service user whose password is about to expire, is easier to understand when you can see the dates.

chage -l jordi
sudo chage -l backupuser

The output lists the last password change, when the password expires, when it becomes inactive, when the account expires, and the minimum and maximum days between changes. The man page says chage is restricted to root except for the -l option, which an unprivileged user can use to check when their own password or account is due to expire.

That makes it a quick check when you hear “my password expired” and you want the exact date. It also helps when auditing service accounts, where you often want Password expires: never.

When something needs changing, the same tool does it, as root. sudo chage -M -1 backupuser removes the maximum age for that account. Think before you do that on a real login account.

The caveat is in the manual: chage reports only what is in the shadow password file. If the account is managed through LDAP or another directory, the settings from there will not show up, so the output can look harmless while the real policy lives somewhere else.

Further reading: chage(1) manual

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link