2
  • I have keys setup on my Linux headless server and Putty on my Windows Desktop.

  • I can connect and authenticate successfully with Putty and authentication is via RSA Keys.

However, if I disable password authentication in sshd_config (PasswordAuthentication no) when I try and connection with Putty I get:

Server refused our key

And yet, if I then enable password authentication again, the key authentication works!

In addition, if I reset permissions of the /.ssh folder and authorized keys to 0700 and 0644, respectively.

I am able to disable password authentication and use the RSA Keys only until system reboot which then returns server refused our key again....

pa4080
  • 29,351
  • 10
  • 85
  • 161
  • post the whole debug log if you want some insight. It is not possible to answer from these information. – Jakuje Dec 19 '16 at 16:39
  • the files in ~/.ssh must have 0600 permissions. – Jean-Marie Dec 19 '16 at 16:53
  • 1
    Possible duplicate of [SSH is allowing remote connections only after a local login to the server](http://askubuntu.com/questions/882303/ssh-is-allowing-remote-connections-only-after-a-local-login-to-the-server) – pa4080 Mar 28 '17 at 10:19

1 Answers1

1

I had the home directory encrypted, this seems to have been the cause. I re-installed and set up SSH again and it worked fine, as soon as the home directory is encrypted, ssh keys won't work without enabling password authentication in sshd.config - must be a workaround for this but for now this works for me.

Zanna
  • 69,223
  • 56
  • 216
  • 327