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.
Incorrect. -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.
Incorrect. -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.
Incorrect. -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.
Correct. 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
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.