Create web01's home and copy initial files from /opt/web-skel instead of /etc/skel.
Which command is appropriate?
useradd -m -k SKEL_DIR creates the home and copies initial files from the chosen skeleton directory.
Detailed explanation
useradd -m -k /opt/web-skel web01Correct. It creates the home and uses /opt/web-skel as the template.
useradd -d /opt/web-skel web01Incorrect. -d would register /opt/web-skel as the user's home.
useradd -s /opt/web-skel web01Incorrect. -s selects the login shell.
useradd -M -k /opt/web-skel web01Incorrect. -M disables home creation.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help | grep -E -- '-k,|-m,'Expected result
--skelと--create-homeの説明行Key points
- -k selects the skeleton directory
- -m creates the home
- Different role from -d
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
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.