Update Linux User's Home Directory

Once in a while, you may want to shift users' home directory to somewhere else like a detachable hard disk. This section guides you through on how to change a user's home directory path.

Prerequisites

Ensure the new home directory is available and shifted before changing it. Otherwise, that user will have hard time using the Linux operating system.

Changing Home Directory

To change the home directory, simply use the -d argument from usermod command:

$ usermod -d <new_path> <user>

Example:

$ usermod -d /var/www/ james

That's all for changing home directory.