Report this

What is the reason for this report?

PuTTY + ssh - "server refused our key"

Posted on May 23, 2014

I tried following along with this article “https://www.digitalocean.com/community/articles/how-to-create-ssh-keys-with-putty-to-connect-to-a-vps” and this article “https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04” to set up ssh with my already existing droplet. Every time I go to putty to ssh in, I get a “server refused our key” message and then I am asked to enter in my password. I must be doing something wrong or have the wrong configuration but I’m not sure what it is. I have re-read both articles many times in order to figure out where I am (possibly) missing something.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

CORE OS Solution:

If using coreos set the username ‘core’ instead of ‘root’.

Once you’ve logged in you can use ‘sudo -i’ to become root.

Just check your secure log. In my case (Centos) the file is locate in /var/log/secure.

In my log: Jan 24 16:52:40 server sshd[19625]: Authentication refused: bad ownership or modes for directory /home/user

After I changed the modes /home/user from 0755 to 0700 I can login with the key.

These are the steps to setup putty ssh login profile, hope this help <br>========================================= <br>ssh-keygen -t rsa -b 2048 -f mykey -C [me@domain.com < your comment] <br>cat mykey.pub >> ~/.ssh/authorized_keys <br>========================================= <br>download mykey <br>download PuTTYgen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html <br>start puttygen <br>go to conversion > import key <br>select downloaded mykey <br>Then [Save private key], you can change key comment if needed <br>========================================= <br>Start putty <br>Key in the host name/ip address together with port, if non standard port is used <br>Then go to [connection] > [ssh] > [auth] <br>Click [Browse] of [Private key file for authentication], choose the previous generated [mykey.ppk] <br>Go back to [Session] <br>Enter the name you want at [Saved sessions] field, then [Save] <br>After all that, hit [Open] <br>Enter your user name when prompted, your should be logged in now <br>========================================= <br>Remeber to remove the generated key files from the server <br>rm mykey mykey.pub <br>========================================= <br>If everything is good, follow the article you mentioned to disable the ssh password login.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.