• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

chage Command Examples in Linux

by admin

chage is a command-line utility in Linux that is used to modify the password aging information for user accounts. Password aging is a security feature that allows you to specify how often users must change their passwords and how long their passwords are valid before they expire.

To modify the password aging information for a user account using chage, you can use the following command syntax:

# chage -M [days] -W [days] [username]

This command will set the maximum number of days that a password is valid to [days] and the number of days before a password must be changed to [days] for the user account [username]. For example, to set the maximum password age to 90 days and the password warning period to 7 days for the user john, you can use the following command:

# chage -M 90 -W 7 john

chage includes many other options and arguments that allow you to customize the password aging information for user accounts. For example, you can use the -d option to specify the date when the password was last changed, or the -I option to specify the number of inactive days after which a user’s password will expire.

For more information on using chage, you can consult the chage documentation or use the chage –help command to view a list of available options and usage examples.

chage Command Examples

1. List password information for the user:

# chage --list username

2. Enable password expiration in 10 days:

# chage --maxdays 10 username

3. Disable password expiration:

# chage --maxdays -1 username

4. Set account expiration date:

# chage --expiredate YYYY-MM-DD username

5. Force user to change password on next log in:

# chage --lastday 0 username

Filed Under: Linux

Some more articles you might also be interested in …

  1. amass enum – Find subdomains of a domain (Command Examples)
  2. swaks Command Examples in Linux
  3. identify Command Examples
  4. st Command Examples in Linux
  5. CentOS / RHEL 7 : Shutting Down, Suspending, or Rebooting Commands (systemctl)
  6. lynis Command Examples in Linux
  7. sesearch: command not found
  8. physlock Command Examples in Linux
  9. jpegtran for image optimization
  10. knife Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright