assign home directory to user linux

C++
usermod -d /path/to/dir username

Source

Also in C++: