create home directory for existing user linux code example
Example 1: assign home directory to user linux
usermod -d /path/to/dir username
Example 2: linux create user with homedir
useradd -m $username
usermod -d /path/to/dir username
useradd -m $username