Report this

What is the reason for this report?

SSH Server refused our key

Posted on June 4, 2017

I’ve been at this an hour and just cannot get SSH to bloody work. I tried this last year and gave up, thought I would give it a crack.

I follow the tutorial: https://www.digitalocean.com/community/tutorials/how-to-create-ssh-keys-with-putty-to-connect-to-a-vps

One difference is the command to close was “Esc, :, w, q, Enter” That did not work so I looked it up and SHIFT + Z + Z saves the file and closes it. I rechecked the file and it indeed saved it.

I go to connect and no lucky, big fat “Server refused our key” I don’t know what to do, why is SSH not easy to setup, I want it to be secure but no lets make it stupidly hard! I’m a go grumble over here and be incredibly appreciative of any help lol



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.

This is an amazing post thank you so much for the detailed answers. I had a similar problem - Filezilla gave an error when trying to upload a file, even though it logged in correctly, showed the directory tree of the server correctly, too.

After genning a new key, making sure I didn’t accidentally remove any of the first characters in the cut and paste of the public key (great hint btw), I found this:

In putty, under File, SiteManager, Advanced tab, click “UNIX” for server type. This clears up the Filezilla rejecting the transfer even though correctly logged in. so random…

Just throwing it out there for anyone who may have a similar issue in the future: I always forget to set file permissions properly when I set up ssh for a new user on my server.

cd ~ chmod -r 700 .ssh chmod 600 .ssh/authorized_keys

Additionally, check that the correct user:group is assigned.

ls -la | grep ssh

If not:

sudo chown -R <user>:<group> .ssh

If you still have your key rejected despite having all of the permissions and ownership set correctly, you may need to change the user’s password from the default “locked” (which is a hash that is or starts with !) to an “impossible” hash (assuming you don’t want the user to log in with a password) with usermod -p "*" username. the full explanation is available at https://arlimus.github.io/articles/usepam/

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.