Change Default Directory for User on a Linux System

You can use the usermod command to change the default home directory for a user.

What this command does is edit the file /etc/passwd. Opening /etc/passwd you will find there is a line for every user, including system users (mysql, posftix, etc), with seven fields per line denoted by colons.

The first field is our user and the last two fields are the starting directory and the shell. For example, the following line will login user mattdamon to /var/www/html/mattdamon.