SSH Key + Putty - from "refused our key" to "unable to open key file"

July 2, 2015 460 views
DigitalOcean WordPress Ubuntu

I've gone through all the tutorials. At first I was getting "refused our key" now I'm getting "unable to open key file".

Didn't setup SSH during droplet creation.

PuttyGen > publickey & privatekey
Enter publickey into SSH Key field in settings>security
Open Putty > Enter IP / private

What am I missing here?

1 Answer


I apologize but there isn't enough information here to really provide much help. Have you tried this article here

Some things to note. Make sure you are including the OpenSSH public key and not the putty public key. An Open SSH key starts with ssh-rsa and is the one you need to include on the settings page.

In your Putty SSH settings go to Connection -> SSH -> Auth Then make sure the box Private key file for authentication points to the matching .ppk file. Make sure this .ppk file is located in a location that your local computer can read. If it's not, you will get the cannot read private key error.

Once thing of note, if it's an existing droplet, and you did not include the key on create, updating the settings -> security section won't work. The DO Control panel can only add keys to new droplets. If you need to add your key to an existing droplet, please do the following.

  1. Log into the droplet over SSH with a password.
  2. Open the ~/.ssh/authorized_keys file with something like nano. You can find a guide on using nano here (This whole guide is great if you are new to working with a terminal btw)
  3. Make a new line and copy and paste the public key over. If you are using putty, you can copy it with Ctrl + C then right click on the putty window. Right click with putty is paste.
  4. Save the file and exit out. Now you should be able to log in with the key pair.
by Pablo Carranza
This tutorial runs through creating SSH keys with PuTTY to connect to your virtual server.
Have another answer? Share your knowledge.