Question

Can't login with SSH key when creating new droplet, but works if I clone...

Posted October 14, 2020 144 views
DigitalOcean

I created a new droplet, assigned the same key I always use, put the new IP in my SSH software and used the same key I always use, and it says “Server refused our key”.

I tried that multiple times, creating both blank droplets, and creating them from apps in the marketplace.

If I do the same thing but create the server from a snapshot of one I know works, choose the same key when setting up, and put that IP in, it works just fine.

What am I doing wrong?

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.

×
2 answers

whatever, I just made a new key and it seems fine

Hello, @skeddtemp

If you ever face the issue again you can quickly use the console in your DigitalOcean account and access your droplet and check if the ssh-key is present on your droplet.

You can make sure that the key is added in:

 ~/.ssh/authorized_keys

If the key is not there you can try adding it via the console or temporary enable the PasswordAuthentication and ssh to the droplet via password and copy the key using this command:

cat ~/.ssh/id_rsa.pub | \
ssh username@IPaddress "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Note: Please change IPaddress with the actual IP address of your droplet.

Hope that this helps!
Regards,
Alex

Submit an Answer