Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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.

share|improve this answer
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.

share|improve this answer

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

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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