Display the current defaults used by useradd without creating a user.
Which command is appropriate?
useradd -D displays current defaults such as the base home directory and login shell.
Detailed explanation
useradd -mIncorrect. -m is a creation option and a username is required.
useradd -rIncorrect. -r creates a system account.
usermod -DIncorrect. Defaults are displayed by useradd, not usermod.
useradd -DCorrect. useradd -D prints the current defaults.
Try it yourself
An example you can run in a temporary verification environment.
useradd -DExpected result
GROUP、HOME、SHELLなどの既定値一覧Key points
- -D means defaults
- It does not create a user
- Use it to inspect defaults
Notes
- Environment: shadow-utils useradd / 読み取りのみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Account record
Identity attributes such as a user ID, home directory, and login shell.
Group membership
Primary and supplementary groups used during permission checks.
Password aging
State and time limits that control password changes and account access.