Skip to content
Linux TLDR
  • 🏠 Home
  • 🐧 Topic
    • All in One
    • DevOps
      • Ansible
      • AWS
      • Docker
      • Git
      • Jenkins
      • Kubernetes
    • Hardware
      • Raspberry Pi
    • How to
    • Linux Commands
      • Builtin Commands
      • Curl Commands
      • Homebrew Commands
      • MySQL Commands
      • SSH Commands
    • Linux Distributions
      • Alma Linux
      • Debian
      • Fedora
      • Kali Linux
      • Linux Mint
      • Manjaro
      • Red Hat
      • Ubuntu
    • News & Updates
    • Package Installer
    • Programming
      • Bash Scripting
      • C/C++
      • Go Lang
      • Java
      • Javascript
      • Node Js
      • Php
      • Python
      • Ruby
    • Reviews
    • Tools
    • Troubleshooting
    • Tutorials
    • Weekly Roundup
    • What is
  • 🕵️ Privacy Policy
  • 📧 Contact Us
  • 📖 About
    • 🪶 Write an Article
    • 🔗 Follow Us
    • 🎁 Donate

Beginners Guide for Chage Command on Linux

Linux TLDR
Last Updated: December 17, 2023
Reading time: 2 minutes

The chage command is identical to the passwd command used to change user account and password expiration information.

Using this command, you can list the user’s password information, enable or disable password expiration, set the account expiration date, or force the user to change their password on their next log in.

Table of Contents

Toggle
  • Tutorial Details
  • Listing Password Information for the User
  • Maximum Number of Days to Change Password
  • Disable Password Expiration
  • Setting the Account Expiration Date
  • Forcing User to Change Password on Next Log-in
  • Setting Days Before the Password Change is Acceptable After the Account Expired
  • Setting Password Expiration Warning Text

Tutorial Details

DescriptionChage (Change User Password Expiry Information)
Difficulty LevelModerate
Root or Sudo PrivilegesYes
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisiteschage
Internet RequiredNo

Listing Password Information for the User

The “-l” or “--list” flag is used to list the password information, like the last password change, password expiration, inactive status, account expiration, and the minimum and maximum number of days between password changes for the specified user.

$ sudo chage -l linuxtldr

Output:

Checking user password information using chage command

Further, when you modify the password information of the target user, you can execute the above command to check their password status.

Maximum Number of Days to Change Password

The “-M” or “--maxdays” flag will set the maximum number of days (ex: “24”) for the specified user account before the password change is acceptable.

$ sudo chage -M 24 linuxtldr

Output:

Setting maximum number of days to change password using chage command

After the threshold reaches 24 days, the user must be forced to update their password.

Disable Password Expiration

If you want to avoid password expiration for the specified user account on the target days, use the “-M” or “--maxdays” flag and set the value to “-1” to disable password expiration.

$ sudo chage -M -1 linuxtldr

Output:

avoiding password expiration of user using chage command

The above command will set the “Password expires” status to “never”.

Setting the Account Expiration Date

Use the “-E” or “--expiredate” flag to specify the account expiration date for the specified user account in “YYYY-MM-DD” date format.

$ sudo chage -E 2023-11-26 linuxtldr

Output:

Setting user password expiration on specific date

The above command will set the “Account expires” date to “November 26, 2023” which you can verify using the “sudo chage -l linuxtldr” command.

Forcing User to Change Password on Next Log-in

The “-d” or “--lastday” flag is used to set the date of the last password change.

You can set it to 0 to force the specified user to change their password on their next log-in.

$ sudo chage -d 0 linuxtldr

Output:

Forcing user to update their password on next login

Setting Days Before the Password Change is Acceptable After the Account Expired

You can use the “-I” or “--inactive” flag to set the number of days of inactivity allowed to the specified user account after the password is expired.

During the inactivity days, users are allowed to update their password.

After the threshold is reached on the specified day, the account will be locked.

$ sudo chage -I 18 linuxtldr

Output:

Setting specific data before password update is acceptable

From the above command, “linuxtldr” has 18 days to update their password after the password has expired.

Setting Password Expiration Warning Text

The “-W” or “--warndays” flag is used to show a warning alarm before the number of days prior to a password change are required.

$ sudo chage -W 5 linuxtldr

Output:

Setting warning text before password update is permitted

The above command will show a warning message on every login five days prior to password expiration.

That was the end; the “-i” and “-R” flags are ignored in the article due to their lack of use in real life.

If you want them to be on the list, let us know in the comment section.

SHARE:

Recommended Articles

🔗How to Install Zabbix Server on Ubuntu 24.04 (Noble Numbat)
🔗Stellar Repair for MySQL – Product Review
🔗How to Install RQuickShare (NearbyShare/QuickShare) on Linux
🔗How to Install RabbitMQ Server on Linux (Quick Guide)
🔗How to Use Chattr Command in Linux (for Beginners)
🔗How to Setup SOCKS5 Proxy Server on Linux Using MicroSocks
🔗Reset the WordPress Admin Password Using CLI (via 2 Methods)
🔗How to Check Python Version in Linux (via 3 Methods)
🔗How to Check PHP Version in Linux (via 4 Methods)
🔗[Fixed] pkg-config script could not be found in Linux

Latest

Install zabbix server on ubuntu

How to Install Zabbix Server on Ubuntu 24.04 (Noble Numbat)

mysql database recovery tool

Stellar Repair for MySQL – Product Review

RQuickShare Linux

How to Install RQuickShare (NearbyShare/QuickShare) on Linux

Install RabbitMQ Server on Linux

How to Install RabbitMQ Server on Linux (Quick Guide)

chattr command

How to Use Chattr Command in Linux (for Beginners)

Newsletter

Explore the latest Linux news, tutorials, tips, and resources to master open-source technology.

Social Handles

quora

Your help is needed

AI and ad blockers are significantly impacting advertising revenue. Donate now to support funding for this independent site.

🎁 Make a Donation
Linux TLDR © 2026 - Discover, Learn, and Master Linux with Us 🐧