PuTTY + ssh - "server refused our key"
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.×
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
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)
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
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.
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: 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.
I had the same problem after following this tutorial : https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
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.