CentOS / RHEL: Set Accounts To Disable After Password Expiration

www.lautt‮moc.iru‬
CentOS / RHEL: Set Accounts To Disable After Password Expiration

To set accounts to be disabled after password expiration on CentOS or Red Hat Enterprise Linux (RHEL), you can use the chage command.

  1. To set an account to be disabled after password expiration, use the chage command with the -M option to specify the number of days after which the password will expire. For example, to set an account to be disabled after 90 days of password expiration, you can use the following command:
sudo chage -M 90 username

Replace username with the actual username of the account that you want to set.

  1. To set an account to be disabled after password expiration, use the chage command with the -I option to specify the number of days of inactivity after which the account will be disabled. For example, to set an account to be disabled after 60 days of inactivity, you can use the following command:
sudo chage -I 60 username

Replace username with the actual username of the account that you want to set.

  1. If you want to set both the password expiration and inactivity limits for an account, you can use the -M and -I options together. For example:
sudo chage -M 90 -I 60 username

This will set the account to be disabled after 90 days of password expiration or 60 days of inactivity, whichever occurs first.

Note: The chage command only works for local accounts, not for accounts that are managed by external authentication systems such as LDAP or Kerberos. To set password expiration and inactivity limits for these types of accounts, you will need to use the tools provided by the authentication system.

Created Time:2017-10-16 14:38:41  Author:lautturi