Table of Contents

Ubuntu - Passwords - Set Up Password Aging for Users

The chage command changes the number of days between password changes and the date of the last password change.

This information is used by the system to determine when a user must change their password.

The /etc/login.defs file defines the site-specific configuration for the shadow password suite including password aging configuration.


Enable Password Aging

sudo chage -M 60 -m 7 -W 7 userName

Disable password aging

sudo chage -M 99999 userName

Get password expiration information

sudo chage -l userName

Finally, you can also edit the /etc/shadow file in the following fields:

{userName}:{password}:{lastpasswdchanged}:{Minimum_days}:{Maximum_days}:{Warn}:{Inactive}:{Expire}:

Where,

It is recommended to use the chage command instead of editing the /etc/shadow file by hand,