Linux chage command

Linux chage command

Understanding the chage Command in Linux

The chage command in Linux is used to manage password aging policies for user accounts. It allows administrators to set expiration dates, enforce password changes, and control other related parameters. This helps enhance security by ensuring users update their passwords regularly.

Syntax

chage [options] username

Commonly Used Options

OptionDescription
-lDisplay password aging information for a user
-m DAYSSet the minimum number of days before a password can be changed
-M DAYSSet the maximum number of days a password is valid
-d DAYSSet the last password change date (counted in days since 1970-01-01)
-E DATESet the account expiration date (YYYY-MM-DD format)
-I DAYSSet the number of inactive days after password expiration before locking the account
-W DAYSSet the number of days before expiration to warn the user

Examples

1. Check Password Aging Information

To check the password expiration details for a user:

chage -l username

Example output:

Last password change : Oct 10, 2024 Password expires : Jan 10, 2025 Password inactive : never Account expires : never Minimum number of days between password change : 7 Maximum number of days between password change : 90 Number of days before password expires to warn user : 7

2. Force a User to Change Password Every 30 Days

chage -M 30 username

This means the user must change their password every 30 days.

3. Set a Warning Before Password Expiration

To warn the user 7 days before password expiration:

chage -W 7 username

4. Disable Account After Password Expiration

To lock the account 10 days after the password expires:

chage -I 10 username

5. Set an Account Expiration Date

To disable a user account after December 31, 2024:

chage -E 2024-12-31 username

6. Manually Change Last Password Change Date

To set the last password change date to October 1, 2024:

chage -d 2024-10-01 username

Security Implications

  • Enforcing regular password changes improves security.
  • Setting an expiration date helps in managing temporary user accounts.
  • Account inactivity settings prevent unauthorized access.

Conclusion

The chage command is a powerful tool for managing password policies on Linux systems. By using it effectively, administrators can enforce security policies and improve overall system safety.

Would you like additional details or modifications for SEO optimization? 🚀

Souy Soeng

Souy Soeng

Our website teaches and reads PHP, Framework Laravel, and how to download Admin template sample source code free. Thank you for being so supportive!

Github

Post a Comment

CAN FEEDBACK
close