Why do I get Server refused our key when trying to connect using SSH connection with Putty and when everything has been configured according to all the Tutorials?

Generating the pair of keys from Windows Laptop and copying the public key on the RPi authorized_keys file

Configuring Putty

In sshd_config file I open Authorized_keys file

chmod 700 ssh and chmod 600 authorized_keys etc......-

And I always get Server refused our key Googling doesn't help I would really appreciate help.

  • Wondering, could this be related to the Heartbleed bug? Possibly someone re-generated some keys and it threw off the connect-ability. – RPiAwesomeness Apr 12 '14 at 20:57
  • Did you use Putty's converter to convert the openssh key to something that Putty can read? – Jacobm001 Oct 27 '15 at 18:05

Your permissiong are correct. The default location for the authorized_keys file is ${HOME}/.ssh/authorized_keys. Check the permission of the directory containing the ".ssh" directory. It cannot have group or world write permission since that would allow someone else to replace your .ssh directory. Also, PuTTY and ssh use differently formatted private/public keys. I use PuTTYgen to create the PuTTY private key saved in a .ppk file and then copy the OpenSSH authorized key and paste that into the authorized_keys file. It will look something like ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAp1hWgFhD6ZWgcfUrY0+zcWas7uH252TMXGWynwZBoTriF8a9Vlo3+NfPNc2xsSvqzJs2fD5LOw1YZe2DGfazBM313vtUKg6aozBsSavYi7o6f/BZPlCh2NZKmLTFB3E0Y0m+ZE3bQXM+rn5dAqb+SU26vgwLKBvarm4tYew87FB1AIDHzFLSDECb7JoEfcpOp8A5yLW97TTaJZAl5mVlig2HeeKrj6zLGxPoK7T0MXxcNbb1arU0LCHfQxIKj+f7T8pHyDMH5ybz2ij52KBMj9HNlQGjZ3Cg7DU7/dNFBWXbn5xedcx9MnycqpulQd6IL8oY3xVWwxpsVhd+MR2GBw== rsa-key-20140419

It should be all on one line in the authorized key file. Typos in public key are another common cause for problems. I have not had to change the configuration for the ssh daemon.


I had the same issue of "Server refused our key". I found out the problem was using sudo nano authorized_keys.

I used nano authorized_keys instead and it worked. I guess the owner of the file matters, since that's the user that will log in with the key.


It's been a while, but I also wanted to add that setting correct permissions for my user directory (e.g. /home/<user>) was important in making this work. In /var/log/auth.log, I found Authentication refused: bad ownership or modes for directory /home/<user>.

Alongside the requisite permissions for the subfolder /.ssh and the file authorized_keys mentioned, it also needed drwxr-xr-x permissions which was resolved by chmod go-w /home/<user>.

  • Giving read permissions to everyone on a home folder seems odd. – Dmitry Grigoryev Jan 12 at 9:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.