I am using Ubuntu 16.04
I am in the root user and typed the command:
usermod -d /home test
I believe this changes the default location of test's home directory to /home. But then when I log into the user, test, the screen goes black and returns to the login screen.
I then go back to my account, and as root, typed the command:
usermod -d /home/test test
/home/test was the original default directory for test.
And then I log into the user test, and I log in successfully.
Why does this happen? What can I do in order to change the default directory of test but not meet a login loop?
For GUI logins, the home directory has to be writable by the user whose directory is being changed, as
steeldriver
mentioned. This way, there will not be any looping logins.If you change the directory to something that is not writable by the user, you can still log in as the user without the loop if you log into tty by doing:
CTRL+ALT+F1-6 (press a key from F1 to F6)
and entering the credentials of the user.