Question
Ubuntu 16.04 Immediately Logs Out When SSH Into Server
When I am trying to log into my Ubuntu 16.04 server via ssh I get immediately logged out after typing in the password. This is only for the justin
user account.
I am able to briefly see this message:
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-166-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
Last login: Tue Nov 5 10:37:59 2019 from 127.0.0.1
Could not chdir to home directory /home/justin: Permission denied
/bin/bash: Permission denied
Connection to localhost closed.
It appears that it is some kind of error message, but when I log in via Root (which successfully logs in) and run ls -la /home/justin
I get the following output:
root@ubuntu-servername:/home# ls -la /home/justin
total 260
drwxr-xr-x 12 justin justin 4096 Sep 29 12:44 .
drwxr-xr-x 3 root root 4096 Jan 16 2018 ..
-rw------- 1 justin justin 17349 Sep 29 12:44 .bash_history
-rw-r--r-- 1 justin justin 220 Jan 16 2018 .bash_logout
-rw-r--r-- 1 justin justin 3794 Apr 2 2018 .bashrc
drwx------ 3 justin justin 4096 Sep 2 12:37 .cache
-rw-r--r-- 1 justin justin 0 Jan 16 2018 .cloud-locale-test.skip
drwxrwxr-x 2 justin justin 4096 Mar 28 2019 crons
drwxrwxr-x 3 justin justin 4096 Sep 2 12:39 dev
drwxrwxr-x 3 justin justin 4096 Jan 23 2018 documents
-rw-rw-r-- 1 justin justin 80 Mar 21 2019 .gitconfig
drwx------ 6 justin justin 4096 Sep 2 12:37 .local
-rw------- 1 justin justin 152 Mar 28 2019 .msmtprc
drwxrwxr-x 2 justin justin 4096 Jan 16 2018 .nano
-rw-r--r-- 1 justin justin 655 Jan 16 2018 .profile
drwxrwxr-x 4 justin justin 4096 Sep 30 22:49 python
-rw------- 1 justin justin 58 Sep 25 12:17 .python_history
-rw------- 1 justin justin 1024 Aug 16 2018 .rnd
-rw-rw-r-- 1 justin justin 75 Mar 28 2019 .selected_editor
drwx------ 2 justin justin 4096 Apr 26 2018 .ssh
-rw-r--r-- 1 justin justin 0 Jan 17 2018 .sudo_as_admin_successful
-rw------- 1 justin justin 14302 Sep 29 12:44 .viminfo
It appears as though every thing in the directory is correctly set to the justin
permission group/user.
I have also run sudo chown justin:justin /home/justin
but I get the same results.
I have restarted the droplet to just to make sure. I am not exactly sure where else to look for information concerning this error. If I could be pointed to a log file that might have more information that would be helpful.
Thanks.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×