CompTIA Linux+ (XK0-006)Services and User ManagementMedium
A system administrator needs to manage a user's password policy. Specifically, they want to enforce that the `appuser` password expires after 90 days, and the user receives a warning 7 days before expiration. Which of the following commands correctly configures these settings?
- Ausermod -e 90 -W 7 appuser
- Bpasswd -x 90 -w 7 appuser
- Cchage -M 90 -W 7 appuser
- Dchage -E 90 -W 7 appuser
Show answer & explanationAnswer & explanation
Correct answer: C. chage -M 90 -W 7 appuser
The `chage` command is used to change user password expiry information. The `-M` option sets the maximum number of days between password changes, and `-W` sets the number of days of warning before password expiration.
Why the other options are wrong
- A. `usermod -e` sets the account expiry date, not password expiry, and `-W` is not a valid option for `usermod`.
- B. `passwd` can set password expiry (`-x`), but not the warning period (`-w` is not a valid option for warning days in `passwd`).
- D. `chage -E` sets the account expiry date, not the password expiry maximum, making this incorrect.
chage command
Used to change user password expiry information and account aging policies in Linux.
- Modifies entries in `/etc/shadow` related to password aging.
- `-M` sets maximum days between password changes.
- `-W` sets warning days before password expiration.
Memory trick: Change (`chage`) your AGE (`-M` for Max, `-W` for Warning) before it's too late!