SSH Key to Existing Droplet

August 14, 2018 2.5k views
Security

I manually edited my authorized_keys file and added my ssh public key.
However when trying to login using the private key in putty I get a disconnected no supported authentication methods available (server sent publickey) error.
I read several threads here but can´t find any way to fix this.
Any ideas?

1 Answer

Hello friend!

The first thing I would do is make sure that your key pair is OpenSSH compatible. For example, this is one of my public keys and yours most likely looks the same:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLmqjzH1lJ+uTlL2yGjyOcFKdxYFWYLSUdqN5LMRA1YiXHJvTkOo4Ky8w8NmNqJoKwLhxESLNpdUteZbacCRf3I9j57td8IaySk3LFpNK1waDwPcwFlvOv6NtKdwFsgQ0CUqJ6Ya9AUVfTlyePBhH9lKy7gnsloAtHOfGlHdCt5X5f2iB0WU/PPZZskfj79z84dlUPrdfdq8DZmOQDnTEF6XnqaYIqrYXKnPOTovCnOGrc1xJjV+UQ7dZhc/5UCECDK8DEUKZ21aK5htCwhqQFLVV4M6SB7/mDiWXvNx79hKuHDHsHCv6L4YuqHkHAGNtmHq2UxntJ9K6i0DxoMq/1 jarlanddonnell@Jarlands-iMac.local

If all is well there, I would add the verbose flag to your SSH connection (ssh -vvv) and go over each line to see what it is doing. If it loads your private keys without error and moves forward without accepting login, I would suggest one of these is true:

  1. The server has been configured to not allow the login at all.
  2. The server is not loading an authorized_keys file that contains your public key.

I couldn’t say for sure which configuration had been changed to cause #1, but #2 should be fine if the public key is on a single line in authorized_keys under /root/.ssh or /home/username/.ssh (if not using root). More than likely I’ve already covered the problem area, taking a closer look at each detail should reveal something that you have not yet noticed. SSH login issues tend to not be very complex at their core.

Kind Regards,
Jarland

Have another answer? Share your knowledge.