I have an ssh server installed on an Ubuntu 14.04 Server. I've noticed some strange things happening.

  1. If I have not logged in locally on the machine, it will not allow login remotely.
  2. If the server account I want to log in as remotely is not currently logged in on the server, I will receive the following error in putty:

Disconnected: No supported authentication methods available (server sent: publickey)

If I try connecting via the ssh command, I get the following:

Permission denied: publickey

I have set:

PasswordAuthentication no

in the /etc/ssh/sshd_config file, and I have added an extra line to the end of my authorized_keys file. How can I solve this?

  • Is the user's home directory on the server encrypted? if so Where is the authorized_keys file located? – steeldriver Nov 25 '14 at 9:26
  • Now that I think about it, it is encrypted. The authorized keys file is located in the users home directory. Looking at this post, superuser.com/questions/61057/… there are two viable options. What are the benefits and drawbacks ofhttp://superuser.com/questions/61057/ssh-with-authorized-keys-to-an-ubuntu-system-with-encrypted-homedir each – user351871 Nov 25 '14 at 16:08

The reason I was getting that error was because my home folder was encrypted, and thus the ~/.ssh/authorized_keys file was inaccessible. I followed the steps listed here and here. The only thing that wasn't mentioned, was that if you decide to use this method, you still need to type in the user password for the machine on each login. For me, that's not a problem, but for some people who have strong passwords (ie. > 16 characters with no easy way to remember them), this may pose an issue, and using the method described here may work better.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy