Set trainee's password to expire after 90 days and warn the user starting 7 days before expiration.
Which command is appropriate?
chage -M DAYS sets the maximum password age and -W DAYS sets the warning period before expiration.
Detailed explanation
chage -M 90 -W 7 traineeCorrect. It sets a 90-day maximum age and a 7-day warning period.
Correct. It sets a 90-day maximum age and a 7-day warning period.
chage -m 90 -I 7 traineeIncorrect. It sets a minimum change interval and an inactive period.
Incorrect. It sets a minimum change interval and an inactive period.
chage -E 90 -d 7 traineeIncorrect. It sets account expiration and last-change date.
Incorrect. It sets account expiration and last-change date.
chage -W 90 -M 7 traineeIncorrect. The maximum and warning values are reversed.
Incorrect. The maximum and warning values are reversed.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-M 90=maximum age 90 days' '-W 7=warn 7 days before expiry'Expected result
-M 90=maximum age 90 days
-W 7=warn 7 days before expiryKey points
- -M is maximum age
- -W is warning period
- Distinguish -m, -I, and -E
Notes
- Environment: shadow-utils chageのoption対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.