Here are steps what i did for ssh key connection:
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.
You can check our article on How to Upload an SSH Public Key to an Existing Droplet
You can access the droplet from the DigitalOcean console and then temporary enable the PasswordAuthentication on your droplet and access the droplet with a password to upload the ssh-key.
If you haven’t created new pair of keys you’ll need to do that first.
You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshd_config file. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your ~/.ssh/authorized_keys file to add the appropriate public key.
This change can be made from the DigitalOcean’s console. If you’re having issues accessing the console you can then reach to our amazing support team that can help you further with this.
To enable the PasswordAuthentication follow these steps:
sudo nano /etc/ssh/sshd_config
sudo nano ~/.ssh/authorized_keys
You can then upload the key using this command:
ssh-copy-id -i ~/.ssh/mykey user@droplet
Hope that this helps!
That is interesting. The good news is that you can limit your scope of thought on this to a fairly small set of items. There’s only so much that can go wrong here. Try this:
ssh -vvv root@IP
See if you get anything in the output that tries to explain the failures. Maybe it couldn’t load id_rsa, for example, and advises on permission changes. Seems unlikely to have permission issues though if you used ssh-keygen. So glance at that but if you see nothing, let’s move on.
Double check that the items in /root/.ssh/authorized_keys are valid. One key per line, no line breaks, no weird spaces. Your key should look something like mine:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLmqjzH1lJ+uTlL2yGjyOcFKdxYFWYLSUdqN5LMRA1YiXHJvTkOo4Ky8w8NmNqJoKwLhxESLNpdUteZbacCRf3I9j57td8IaySk3LFpNK1waDwPcwFlvOv6NtKdwFsgQ0CUqJ6Ya9AUVfTlyePBhH9lKy7gnsloAtHOfGlHdCt5X5f2iB0WU/PPZZskfj79z84dlUPrdfdq8DZmOQDnTEF6XnqaYIqrYXKnPOTovCnOGrc1xJjV+UQ7dZhc/5UCECDK8DEUKZ21aK5htCwhqQFLVV4M6SB7/mDiWXvNx79hKuHDHsHCv6L4YuqHkHAGNtmHq2UxntJ9K6i0DxoMq/1 jarlanddonnell@Jarlands-iMac.local
Also unlikely that key login is disabled on the droplet, so I’m kind of thinking you may find something there in authorized_keys.
Join 1M+ other developers and: