Question

PuTTY + ssh - "server refused our key"

  • Posted on May 23, 2014
  • vjeornAsked by vjeorn

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.

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi,

I was having a same problem, I read a few tutorials here in DO and I believe I know what the problem was.

My step was: create a new droplet (brand new account / droplet), not using any key and THEN generate a key after the droplet created.

The problem was, the key was not automatically assigned to the droplet (I read this on one of the tutorials). It is possible to assign the key into an existing droplet (again, read on tutorial) but I didn’t use that solution.

My solution: I deleted the key from DO’s record, delete the droplet (luckily it was still empty) and then create a new droplet, but this time, using the key since the beginning (when it was asked during droplet’s creation, whether we want to use a key or not). Basically just start from scratch, but this time I “rearranged” the steps. I was using the same key, there was a pop up saying that this key already cached but on different droplet (something along that line), hit yes, and everything works.

Just a suggestion, DO should warn the user regarding this issue. Well… I don’t really think that this is an issue / bug, but… I think it’d be nice to know this since the beginning. For example, on this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server

On this part “Step Seven-Select SSH Keys (Optional)” >> It should be clear that it would take more, extra effort if we choose to create a key later (manually assign it to the droplet).

Again, just a suggestion. HTH

Re-check your permissions and ensure 0700 for ~/.ssh and 0644 for the authorized_key file in that folder. Also, <br> <br># sudo chown -R username:username /home/username <br> <br>Change username to your user. Also make sure the authorized_key is inside the .ssh folder in your user’s home folder, not /root/.ssh (unless you’re using the key for your root user as well).

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.