Create alice with useradd and create the home directory in the default location.
Which command is appropriate?
useradd -m creates the home directory and normally copies the /etc/skel template.
Detailed explanation
useradd -m aliceCorrect. -m requests home creation during user creation.
Correct. -m requests home creation during user creation.
useradd -M aliceIncorrect. -M explicitly disables home creation.
Incorrect. -M explicitly disables home creation.
usermod -m aliceIncorrect. usermod changes an existing account and does not use -m this way.
Incorrect. usermod changes an existing account and does not use -m this way.
passwd -m aliceIncorrect. passwd does not create home directories with -m.
Incorrect. passwd does not create home directories with -m.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help 2>&1 | grep -E -- '--create-home|-m,' | head -n 1Expected result
-mまたは--create-homeの説明Key points
- -m creates home
- -M disables creation
- Copy skel
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.