Question

Only console login works - new droplet - existing SSH key used during creation - "Server refused key" error

I setup my first droplet [2 years ago], added my SSH key, and can login fine from my local SSH client (MTPuTTY).

I setup a second droplet today and used the same key (autodetected during setup) and am able to login via the console.

I can see .ssh/authorized_keys on the second droplet matches the contents from the same file on the first droplet, just with an additional key added by the droplet agent on the second droplet’s file.

SO FAR SO GOOD.

I can’t login to the second droplet via MTPuTTY though. I get “Disconnected. No supported authentication methods available (server sent: publickey)” via the UI and “Server refused our key” via the log (below).

I used the same PuTTY config file, and double checked it was still pointing to the matching private key, only the IP address is different (changed to point to the second droplet).

I tried enabling UFW and opening port 22, even though this port has to be open for the console to work, right?

What else can I try to resolve this?

When I debug the SSH connection, I get:

Event Log: Connecting to xxx.xx.xxx.xx port 22
Event Log: We claim version: SSH-2.0-PuTTY_KiTTY
Event Log: Server version: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3
Event Log: Using SSH protocol version 2
Event Log: Doing ECDH key exchange with curve Curve25519 and hash SHA-256
Event Log: Server also has ecdsa-sha2-nistp256 host key, but we don't know it
Event Log: Host key fingerprint is:
Event Log: ssh-ed25519 256 (deleted)
Event Log: Initialised AES-256 SDCTR client->server encryption
Event Log: Initialised HMAC-SHA-256 client->server MAC algorithm
Event Log: Initialised AES-256 SDCTR server->client encryption
Event Log: Initialised HMAC-SHA-256 server->client MAC algorithm
Event Log: Reading key file "xxx\file_name.ppk"
Event Log: Offered public key
Event Log: Server refused our key
Event Log: Disconnected: No supported authentication methods available (server sent: publickey)

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @ipromisebank,

Thre are 3 possible solutions the way I see it.

The first one is, that your key doesn’t match. What I’ll recommend here is use the console to enter your Droplet and in the /root/.ssh/authorized_keys file remove the line that was added and add your public key again.

The second issue that might be is that Putty is not seeking the proper private key (maybe a path issue or something similar).

Lastly, if you’ve touched any permissions or ownership of the /root/.ssh folder and the files inside, the SSH service might not be able to read them.

Try the first two suggestions. Sometimes it’s simple like that. Try replacing the public key in your authorized_keys file, try updating the private_key and it’s path in Putty.