Lock alice's password field without deleting the account.
Which command is appropriate?
usermod -L locks the password field; other authentication methods such as SSH keys require separate controls.
Detailed explanation
usermod -L aliceCorrect. -L adds a lock marker to the password field.
Correct. -L adds a lock marker to the password field.
usermod -U aliceIncorrect. -U unlocks the password field.
Incorrect. -U unlocks the password field.
userdel aliceIncorrect. userdel removes the account record.
Incorrect. userdel removes the account record.
chage -l aliceIncorrect. chage -l only lists aging information.
Incorrect. chage -l only lists aging information.
Try it yourself
An example you can run in a temporary verification environment.
usermod --help 2>&1 | grep -E -- '--lock|-L,' | head -n 1Expected result
-Lまたは--lockの説明Key points
- -L locks password
- Does not delete account
- Other authentication is separate
Notes
- Environment: shadow-utils usermod / help読取のみ
- 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.