Set alice's login shell to /bin/bash when creating the account.
Which command is appropriate?
useradd -s SHELL sets the login shell field in the new account's passwd record.
Detailed explanation
useradd -d /bin/bash aliceIncorrect. -d sets the home directory.
Incorrect. -d sets the home directory.
useradd -g /bin/bash aliceIncorrect. -g selects the primary group.
Incorrect. -g selects the primary group.
useradd -s /bin/bash aliceCorrect. -s /bin/bash selects the login shell.
Correct. -s /bin/bash selects the login shell.
useradd -u /bin/bash aliceIncorrect. -u sets a numeric UID.
Incorrect. -u sets a numeric UID.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help 2>&1 | grep -E -- '--shell|-s,' | head -n 1Expected result
-sまたは--shellの説明Key points
- -s sets shell
- Seventh passwd field
- Verify the path
Notes
- Environment: shadow-utils useradd / 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.