PuTTY + ssh - "server refused our key"

Posted May 23, 2014 154.9k views

By vjeorn

I tried following along with this article "" and this article "" 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.

These answers are provided by our Community.

If you run into issues leave a comment, or add your own answer to help others.

13 answers

Posted May 23, 2014

Re-check your permissions and ensure 0700 for ~/.ssh and 0644 for the authorized_key file in that folder. Also,

# sudo chown -R username:username /home/username

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). View 3 responses to this answer on our full site

Posted April 16, 2015


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:

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

View 5 responses to this answer on our full site

Posted July 12, 2015

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.

View 3 responses to this answer on our full site

Posted March 23, 2017

Digital Ocean needs to put in their dashboard a note saying that the SSH keys must be created prior to creating a new droplet! I wasted way too much time trying to get this to work and its even worse when you got a droplet already created and apps setup.

Here’s what I did for those who need help on this issue. I used Mobaxterm and generated SSH keys at the local terminal.

ssh-keygen -t rsa (accept all defaults)
cd /home/mobaxterm/.ssh

Copy and paste the output into Add SSH form box
Create SSH session w/advanced settings pointing at private key
Create SFTP session w/advanced settings pointing at private key

To determine folder locations on the windows box that correlate with Mobaxterm, look at your Settings | Configuration | Persistent home directory and click on the folder to see the Windows directory its located in. Its usually your C:/Users/uername/Documents/Mobaxterm/home/.ssh

Posted December 16, 2014

Digital Ocean needs to improve these tutorials. Digital Ocean needs to improve them not their customers. Your customer’s follow them only to learn that they lack detail, skip steps, or just plain suck. It leads to a lot of non-value adding activity.

View 1 response to this answer on our full site

Posted May 23, 2014

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

Posted January 24, 2015

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.

Posted January 16, 2016

My problem was found in the var/ logs/secuirty apparently, i used a windows text editor that caused a /r switch to be entered into the /bin/bash command when attempting to login. tech support gave me a command to reset it. I will look around to find it.

usermod -s /bin/bash root

Posted April 17, 2016

I had same problem, tried everything but kept refusing my key, or prompting me for a password in addition to the key.

Turns out i kept accidentally creating a droplet using CoreOS instead of CentOS…not sure what the deal is with CoreOS…but glad i don’t need to use that right now or i would be in for trouble or switching to a i different service.

Posted April 27, 2016

If you just upgraded Ubuntu 15.04/10 to Ubuntu 16.04 LTS (or otherwise upgraded OpenSSH from v6.9 to v7.0 you may be getting the ssh refusal because of changes in OpenSSH.

I was specifically getting this error in the /var/log/auth.log (via Webmin): sshd[2444]: userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes [preauth].

For this specific error, you need to add “PubkeyAcceptedKeyTypes=+ssh-dss” (without the quotations) to the bottom of your /etc/ssh/sshd_config file.


Posted August 28, 2016

I had the same problem after following this tutorial :

I first thought, I had to use chmod 644 rather than 600 for the authorized_keys file as @Tecca suggests, I tested both now that I solved my problem and it makes no difference to use one or another.

PuTTY Key Generator inserted some sort of “carriage return” in my public SSH key so the copy / paste was incomplete. Maybe others will have the same issue, so I strongly recommend you to double check if your key is complete.

Posted February 1, 2021

For troubleshooting do # tail -f /var/log/auth.log.

This answer is copied from here -

Posted April 24, 2021

Try restarting the ssh service

sudo service ssh restart

That worked for me =)