To set a user’s password to never expire in Linux, use:
To verify:
Linux controls password aging using the chage (change age) command.
-M → Maximum number of days a password is valid
-E → Account expiration date
-I → Inactive days after password expires
This sets maximum password age to unlimited.
If you also want the account to never expire:
Example output:
You have a service account used by:
Application services
Cron jobs
Monitoring tools
If the password expires:
To prevent this:
Set password expiry to never
But restrict login shell (/sbin/nologin)
Use strong password policies
Example:
In production:
Never set normal human user passwords to never expire
Only service accounts should have non-expiring passwords
Use password vault or IAM where possible
Password aging details are stored in:
Fields affected:
Maximum password age
Password expiry date
Inactive days
“In production, we use
chage -M -1to prevent service account password expiry, but never disable expiry for regular users due to security compliance.”
Not a member yet? Register now
Are you a member? Login now