Move app01's home to /srv/users/app01 and move the old home contents there.
Which command is appropriate?
usermod -d NEW_HOME -m USER changes the registered path and moves the old home contents into the new directory.
Detailed explanation
usermod -m /srv/users/app01 app01Incorrect. -m is used with -d and does not take the path alone.
usermod -d /srv/users/app01 app01Incorrect. -d alone changes registration but does not request a move.
usermod -M -d /srv/users/app01 app01Incorrect. -M is not the usermod option for moving a home.
usermod -d /srv/users/app01 -m app01Correct. It combines the new path with the move operation.
Try it yourself
An example you can run in a temporary verification environment.
usermod --help | grep -E -- '-d,|-m,'Expected result
--homeと--move-homeの説明行Key points
- -d sets the new home
- -m moves contents
- Use both together
Notes
- Environment: shadow-utils usermod 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.