Unlock alice's password after it was locked with passwd -l.
Which command is appropriate?
passwd -u removes the password lock marker; it is different from allowing an empty password.
Detailed explanation
passwd -l aliceIncorrect. -l locks the password.
Incorrect. -l locks the password.
passwd -u aliceCorrect. -u unlocks the password field.
Correct. -u unlocks the password field.
passwd -S aliceIncorrect. -S shows password status.
Incorrect. -S shows password status.
passwd -d aliceIncorrect. -d removes the password rather than unlocking its previous hash.
Incorrect. -d removes the password rather than unlocking its previous hash.
Try it yourself
An example you can run in a temporary verification environment.
passwd --help 2>&1 | grep -E -- '--unlock|-u,' | head -n 1Expected result
-uまたは--unlockの説明Key points
- -u unlocks
- -l locks
- -d deletes password
Notes
- Environment: shadow-utils passwd / 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.