chage

chage is a command-line utility in Unix-like operating systems, including Linux, used to manage and view password aging policies for user accounts. It allows system administrators to set or modify various password-related settings, such as how long a password remains valid before it must be changed, when a user account will be disabled, and when the user will be warned about an upcoming password expiration.

Common Uses:

  • Set Password Expiration: Define the maximum number of days a password can be used before it must be changed.
  • Set Minimum Days Between Changes: Specify the minimum number of days that must pass before a user can change their password again.
  • Set Inactive Account: Determine how many days after a password expires the account will be disabled if the password is not changed.
  • Set Last Password Change Date: Modify the date when the password was last changed.

Basic Syntax:

chage [options] username
  • username: The name of the user account for which you want to modify password aging settings.

Common Options:

  • -l: Display the current password aging information for the user.
  • -m: Set the minimum number of days between password changes.
  • -M: Set the maximum number of days a password is valid.
  • -d: Set the date of the last password change.
  • -E: Set the account expiration date.
  • -I: Set the number of days of inactivity after a password expires before the account is locked.
  • -W: Set the number of days before password expiration that the user will receive a warning.

Examples:

  • View Password Aging Information:
  chage -l username

This command displays the current password aging settings for the specified user.

  • Set Password Expiration to 90 Days:
  sudo chage -M 90 username

This sets the maximum number of days a password is valid to 90 days.

  • Set Account to Expire on a Specific Date:
  sudo chage -E 2024-12-31 username

This command sets the user account to expire on December 31, 2024.

  • Set a Warning 7 Days Before Password Expiration:
  sudo chage -W 7 username

This command ensures the user is warned 7 days before their password expires.

Use Cases:

  • Enforcing Security Policies: System administrators use chage to enforce password policies that require users to update their passwords regularly, enhancing security.
  • Managing User Accounts: chage helps manage user accounts in environments where strict access control and password management policies are necessary.

chage is a useful tool for maintaining and enforcing security policies related to user passwords on Linux systems, ensuring that passwords are regularly updated and that inactive accounts are properly managed.

Leave a Reply

Your email address will not be published. Required fields are marked *