Register /bin/bash as the login shell for new user dev01.
Which command is appropriate?
useradd -s SHELL sets the login-shell field for a new account.
Detailed explanation
useradd -d /bin/bash dev01Incorrect. -d specifies the home directory path.
Incorrect. -d specifies the home directory path.
useradd -g /bin/bash dev01Incorrect. -g specifies the primary group.
Incorrect. -g specifies the primary group.
useradd -s /bin/bash dev01Correct. -s /bin/bash sets the login shell.
Correct. -s /bin/bash sets the login shell.
useradd -G /bin/bash dev01Incorrect. -G specifies supplementary groups.
Incorrect. -G specifies supplementary groups.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help | grep -E -- '-s,|--shell'Expected result
-sまたは--shellの説明行Key points
- -s selects the shell
- -d selects the home
- -g and -G select groups
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.