chage Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

The chage command in Linux is a potent utility used to manage and control password aging for user accounts. As a system administrator, understanding the chage command in Linux is crucial for managing user security policies effectively. This command offers the ability to set the lifespan of a password and to decide when a password must be changed.

Syntax of chage Command in Linux

The basic syntax of the chage command in Linux is as follows:

Where:

  • options: These are flags or parameters that determine how the chage command will function.
  • USER_NAME: The username for which you want to modify the password aging settings.
Sharpen Your Fundamentals with Free Learning

Options in chage command in Linux

  1. -l, --list: Lists the current password aging settings for the user.

    For example -

    Output:

    This command lists all password aging information for 'username'.

  2. -E, --expiredate: Sets the date when the user account will be disabled.

    For example -

    This command sets the expiration date for 'username' to December 31, 2023.

  3. -M, --maxdays: Sets the maximum number of days during which a password is valid.

    For example -

    This command sets the maximum number of days the password of 'username' will remain valid to 60 days.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Example Usages

  • Check the current password aging settings:

    Output:

    Explanation: This usage shows the current password aging settings for 'username'.

  • Change the maximum password age:

    Explanation: This usage sets the maximum password age for 'username' to 90 days.

Tips

  • The chage command must be executed with root or sudo privileges.

  • It is a good practice to regularly review and enforce password aging policies to maintain system security.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advanced Use Cases of chage Command in Linux

  • Set a warning period for password expiry:

    Explanation: This command will set a warning period of 7 days before the 'username' password expires.

  • Set the minimum password age:

    Explanation: This command sets the minimum password age for 'username' to 5 days.

  • Make a password never expire:

    Explanation: This command sets the maximum number of days between password changes to -1, indicating that the 'username' password will never expire.

Conclusion

  • The chage command in Linux is an effective tool for managing password aging policies.

  • It can be used to list current settings, set expiration dates, and control password lifespan.

  • Regular use of the chage command is an essential part of good system security practice.