- 1How to Add a New User in Linux
- 2Modify Existing User in Linux
- 3Delete a User in Linux — Step-by-Step for Beginners
- 4Create a User Group in Linux - Step-by-Step Tutorial
- 5Linux: Add User to Group
- 6How to Remove a User from a Group in Linux
- 7Delete a User Group in Linux - Beginner Friendly Tutorial
- 8Linux su Command Tutorial – Switch Users Easily
- 9Linux sudo Command - Execute as Another User
- 10Change a User's Password in Linux Using passwd
- 11Set Password Expiry in Linux using chage
- 12Lock a User Account in Linux
- 13How to Unlock a User Account in Linux
- 14Configure User Login Shell in Linux
- 15How to Configure User Environment Variables in Linux
- 16Edit .bashrc and .profile in Linux - User Startup Files Tutorial

- 1Linux Topics Index
- 2How to Create a File in Linux
- 3How to Rename a File in Linux
- 4How to Copy a File in Linux
- 5How to Move a File in Linux
- 6How to Delete a File in Linux
- 7How to Create a Directory in Linux
- 8How to Delete a Directory in Linux
- 9How to Copy Directories Recursively in Linux
- 10Delete Directories Recursively in Linux
- 11How to View Hidden Files in Linux
- 12How to Create a Hidden File in Linux
- 13How to Create a Hidden Directory in Linux
- 14How to Find Files in Linux Using find Command
- 15Find Files in Linux Using locate Command
- 16How to View File Contents Using cat in Linux
- 17How to View File Contents Using less in Linux
- 18View File Contents Using the more Command in Linux
- 19Compare Files Using diff Command in Linux
- 20Compare Files in Linux Using cmp Command
- 21Check File Type in Linux with file Command
- 22Create Symbolic Links with ln -s in Linux
- 23How to Archive Files Using tar Command in Linux
- 24Compress Files with gzip in Linux – Beginner Tutorial
- 25How to Compress Files Using bzip2 in Linux
- 26Compress Files in Linux Using zip Command
- 27Extract Compressed Files using tar in Linux
- 28Extract ZIP Files on Linux with unzip
- 29How to Extract .gz Files using gunzip in Linux

- 1How to Add a New User in Linux
- 2Modify Existing User in Linux
- 3Delete a User in Linux — Step-by-Step for Beginners
- 4Create a User Group in Linux - Step-by-Step Tutorial
- 5Linux: Add User to Group
- 6How to Remove a User from a Group in Linux
- 7Delete a User Group in Linux - Beginner Friendly Tutorial
- 8Linux su Command Tutorial – Switch Users Easily
- 9Linux sudo Command - Execute as Another User
- 10Change a User's Password in Linux Using passwd
- 11Set Password Expiry in Linux using chage
- 12Lock a User Account in Linux
- 13How to Unlock a User Account in Linux
- 14Configure User Login Shell in Linux
- 15How to Configure User Environment Variables in Linux
- 16Edit .bashrc and .profile in Linux - User Startup Files Tutorial
How to Set Password Expiry Rules Using chage
Next Topic ⮕Lock a User Account in Linux
How to Set Password Expiry Rules Using chage
Hey there! 👋 Welcome to this tutorial where we explore how to set password expiry rules for users in Linux using a simple but powerful command — chage
.
As a system administrator or even a curious Linux learner, it's important to ensure that users change their passwords regularly. That's where chage
comes in handy!
🔧 What is chage
?
The chage
command lets you view and update the password aging information for a user. You can control things like how often a user must change their password, how long before it expires they get a warning, and more.
📦 Step 1: Check If chage
Is Installed
Most Linux distros come with chage
pre-installed. Just to be sure, run:
which chage
/usr/bin/chage
If it doesn't show a path, you may need to install the passwd
or shadow-utils
package depending on your distro.
👤 Step 2: View Current Expiry Settings for a User
Let’s say you want to check expiry details for a user named john
:
sudo chage -l john
Last password change : Jul 02, 2025
Password expires : Sep 30, 2025
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 90
Number of days of warning before password expires : 7
This output tells you when the password was last changed, when it will expire, and more.
✏️ Step 3: Set Password Expiry Rules
Now let’s set some rules for our user john
.
Set the maximum number of days a password remains valid (e.g., 60 days):
sudo chage -M 60 john
Set the minimum number of days before a user can change password again (e.g., 1 day):
sudo chage -m 1 john
Set the number of days before password expiry to warn the user (e.g., 5 days):
sudo chage -W 5 john
Set account expiration date (e.g., disable account after Oct 31, 2025):
sudo chage -E 2025-10-31 john
You can combine multiple options in one command too:
sudo chage -M 60 -m 1 -W 5 -E 2025-10-31 john
✅ Step 4: Confirm the Changes
After setting the rules, verify them again:
sudo chage -l john
This helps confirm your new password aging policy has taken effect.
🔒 Why This Matters
Regularly expiring passwords is a critical step in securing user accounts — especially on multi-user or production Linux servers. With chage
, you’re in full control of password policies!
And that's it! You're now ready to enforce password aging rules using chage
. 💪
See you in the next lesson!