Fixing "Could not chdir to home directory" on a homeless user

Solution 1:

You can set the user home directory with usermod -d _homedir_ username command.

For example:

usermod -d / sudouser

sets the homedir of sudouser to the root directory.

However, root directory is not a good choice here, especially if you login with the user to an interactive shell. Shells might create their own files when you are logging in, and any extra files in root level is not a good thing.