Skip to main content

Module 6: User & Permission Management

Lesson 57: chage Command

In this lesson, you'll learn how to use the chage command to view and modify user password expiry and aging information in Linux.

The chage command is used to modify the user password expiry information. It enables you to view user account aging information, change the number of days between password changes, and set the date of the last password change.

Once you have set password expiry and aging information, this information is used by the system to determine when a user must change his/her password.

Normally, companies or organizations have certain security policies that demand users to change passwords regularly. Let's explain a simple way to enforce such policies.

chage Command Syntax

# chage [OPTIONS] USERNAME

chage Command Options

Option Description
-l View the account aging information for a user
-d DATE Set the date or number of days (since Jan 1, 1970) when the password was last changed
-E DATE Set the date on which the user's account will no longer be accessible
-W DAYS Set the number of days of warning before a password change is required
-I DAYS Set the number of days of inactivity after password expiry before the account is locked
-m DAYS Set the minimum number of days between password changes
-M DAYS Set the maximum number of days between password changes

1. View User Password Aging Information

To view a user account aging information, use the -l flag as shown:

# chage -l ubuntu
Last password change                    : Oct 01, 2023
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

2. Set the Last Password Change Date