Changing a User’s Home Directory in Ubuntu

Use Case Scenario 
You have just added a new user to your Ubuntu 14.04 web server, but you want to set a specific home directory for this user. For example, you have a contributing web developer and you only want to give them access to your WordPress wp-content folder so they can read and write plugins and themes, but cannot access the rest of the app, media and server files.

Here’s the basic command:
sudo usermod -d /path/to/new/home -m *username*


Question: What will this do?

Answer: It will copy all files from your current home directory to /path/to/new/home and will also update the system file that stores the location of your home directory (/etc/passwd).

Question: What if I don’t want to copy all of their existing home files?
(Good question, because it would not make sense to do that in the example I just gave you).
Answer: just remove the -m from the command

sudo usermod -d /path/to/new/home *username*

To learn more about the “usermod” command, see usermod options.