lchage
Modify file SELinux security context
TLDR
Disable password expiration for the user
Display the password policy for the user
Require password change for the user a certain number of days after the last password change
Start warning the user a certain number of days before the password expires
SYNOPSIS
lchage [options] LOGIN
lchage -l [options] LOGIN
PARAMETERS
-d, --last-change LAST_CHANGE
Sets the date of the last password change. The date can be specified as YYYY-MM-DD or as the number of days since January 1, 1970 (Epoch).
-E, --expiredate EXPIRE_DATE
Sets the account expiration date. This date can be specified as YYYY-MM-DD or as days since Epoch. An expired account cannot log in.
-I, --inactive INACTIVE_DAYS
Sets the number of days after a password expires until the account is locked. A value of -1 disables this inactivity period.
-l, --list
Displays the current password aging information for the specified LOGIN account. This option is typically available to all users for their own accounts, while other options require root privileges.
-m, --mindays MIN_DAYS
Sets the minimum number of days between password changes. A value of 0 means the user can change their password at any time.
-M, --maxdays MAX_DAYS
Sets the maximum number of days a password is valid. After this period, the user will be prompted to change their password. A value of -1 disables password expiration.
-W, --warndays WARN_DAYS
Sets the number of days of warning before a password expires. The user will be notified this many days in advance.
LOGIN
The username of the account to modify or query. This is a mandatory argument.
DESCRIPTION
lchage is a command-line utility conceptually used to display or modify password aging information for local user accounts. It directly manipulates the data typically stored in the /etc/shadow file, which contains secure user account information, including password expiration and aging policies.
This command allows administrators to control various aspects of a user's password lifecycle, such as the date of the last password change, the minimum and maximum number of days between password changes, the number of days of warning before a password expires, and the number of days an account may remain inactive after a password has expired before being locked.
By setting these parameters, lchage helps enforce security policies and ensures that users periodically update their passwords, reducing the risk of unauthorized access due to compromised or stale credentials. While many modern Linux distributions primarily use the chage command for this functionality, lchage would serve a similar purpose, specifically targeting local user accounts to manage their password aging attributes. It's an essential tool for maintaining robust account security.
CAVEATS
lchage requires root privileges to modify any password aging information. Standard users can only use the -l option to list their own password aging details.
It directly modifies the /etc/shadow file; incorrect usage can lead to user accounts being locked out or security vulnerabilities.
It is important to note that lchage is not a standard command on many popular Linux distributions (e.g., Debian, Ubuntu, Red Hat Enterprise Linux, Fedora). The widely used and functionally equivalent command for managing password aging is chage. If lchage exists on a system, it is often a symbolic link to chage or a legacy utility specific to a particular environment. Users should generally prefer chage for this functionality.
PERMISSIONS
Modifying password aging information using lchage typically requires root user privileges. The command operates on the /etc/shadow file, which is a critical system file containing sensitive user password hashes and account expiration details. Unauthorized access or modification of this file is restricted to prevent security breaches.
IMPACT ON USERS
Incorrectly setting password aging parameters can significantly impact user experience and system security. For instance, setting -M 0 (maxdays to 0) would force a password change at the next login, while setting a very low -M value could lead to frequent, disruptive password changes. Conversely, a very high or -1 value could compromise security by allowing passwords to remain unchanged indefinitely.
HISTORY
The concept of password aging and management tools like lchage (and more commonly, chage) emerged with the development of the shadow password suite for Linux. This suite, including programs that manage /etc/shadow and /etc/passwd, was designed to enhance system security by separating encrypted password hashes from public user information in /etc/passwd. Tools like chage (and conceptually lchage) were developed to give administrators granular control over password policies, which became increasingly important with the rise of networked systems and the need for stronger security practices. While chage became the predominant tool, lchage might represent an earlier, localized variant or a specific implementation tailored for certain system configurations.