I've been trying to set up public key/private key logins and being unsuccessful at it. I've been following a guide that may/may not be incomplete. I did the following:

  • Generated a public/private key pair with puttygen.
  • Uploaded the public key to the server
  • Moved that public key to /home/user_name/.ssh/authorized_keys
  • Set up putty to use key auth

When I then attempt to log in I get the message

The server has refused our key

Have I done something wrong?


You need some special format when you use putty.

You should look at the logs: /var/log/auth to find out what happened what is preventing your logon. It is usually permission problem or line breaks in the key (it should be all in one line) or in the case of putty wrong key format.

  • 1
    the key was generated on my windows desktop by puttygen - so its probably in the right format. After I posted this I generated the key on the server, then downloaded the private key, imported that to puttygen, and this works; however downloading your private key can't be terribly secure -- I need to find a way to make puttygen's public key work on the server. but seems you hit the nail on the head. – ESW Jun 22 '10 at 14:43
  • If you download the key with scp, there is no problem. If you use FTP though, you are right. – wzzrd Jun 22 '10 at 18:10

It is possible to use a RSA key generated by puttygen.

Here's a video tutorial on how to use your RSA key from puttygen with openssh. It is pretty straightforward to follow.


there is a good chance the permissions on your ~/.ssh folder, or your home directory itself are too loose.


The key gotcha I've come across is the file permissions on the ~/.ssh/ directory - it should not be group or world readable or ssh will not use it. However if you create the directory manually then it won't have the correct permissions. The command to use to change the directory to have the correct permissions is:

chmod 700 ~/.ssh

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.