• 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

CentOS / RHEL : How to configure a user account to never expire (disable password ageing)

by admin

Question : How to configure a user account so that the password will never expire?

Answer:

By default passwords do not expire on user accounts. If an expiration date has been added to an account and you wish to remove it use either the passwd or chage commands to change the maximum number of days between password changes to -1.

For example, modifying the user “krishna” whose account is currently set to expire in 30 days:

# chage -l krishna
Minimum: 0
Maximum: 30
Warning: 7
Inactive: -1
Last Change: Nov 19, 2007
Password Expires: Dec 19, 2007
Password Inactive: Never
Account Expires: Never

As you can see from the output above, the maximum number of days between password changes is set to 30 days. Modify the maximum days so that the password does not expire:

# passwd -x -1 krishna

or

# chage -M -1 krishna

Verify

Verify the new value of “maximum number of days between password changes”. It should be -1.

# chage -l krishna
Minimum: 0
Maximum: -1
Warning: 7
Inactive: -1
Last Change: Nov 19, 2007
Password Expires: Never
Password Inactive: Never
Account Expires: Never
Solaris : How to configure a user account to never expire (disable password aging)

Filed Under: Linux

Some more articles you might also be interested in …

  1. quotacheck Command Examples in Linux
  2. jobs Command Examples in Linux
  3. btm: An alternative to top
  4. How to add header and trailer line to a file in Linux
  5. who: command not found
  6. hardinfo: command not found
  7. ansible-playbook – Execute tasks defined in playbook on remote machines over SSH
  8. swapon: command not found
  9. ufw Command Examples in Linux
  10. dexter: Tool for authenticating the kubectl users with OpenId Connect

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