CentOS / RHEL: Set Accounts To Disable After Password Expiration

In CentOS and Red Hat Enterprise Linux (RHEL), you can set accounts to disable after password expiration by using the chage command. The chage command allows you to modify the password aging information for a user account.

Here’s how you can set an account to disable after password expiration:

  1. Open the terminal and log in as root or with a user with sudo privileges.
  2. Use the following command to change the password aging information for a user account:
chage -M <number of days> <username>

For example, to set an account to disable after 60 days of password expiration, use the following command:

chage -M 60 <username>
  1. To verify that the account has been set to disable after password expiration, use the following command:
chage -l <username>

This will display the password aging information for the user, including the maximum number of days a password may be used and the number of days since the password was last changed.

Note: To set accounts to automatically lock after a specified number of password attempts, you’ll need to configure the PAM (Pluggable Authentication Modules) module in the Linux system.

Leave a Comment