• 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. How to Customize Linux Password Expiration and Complexity Requirements
  2. udevadm Command Examples in Linux
  3. scontrol Command Examples in Linux
  4. playerctl Command Examples in Linux
  5. ascii: command not found
  6. sstat: command not found
  7. How to split iso or file using ‘split’ command in Linux
  8. What are Bash Exit Codes in Linux
  9. CentOS / RHEL : How to restore/recover a deleted volume group in LVM
  10. “docker exec” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright