SSH Permission denied (publickey) DigitalOcean Ubuntu

Corey picture Corey · Feb 9, 2018 · Viewed 17.2k times · Source

I can't seem to log in to my droplet on digitalocean.

When I try ssh [email protected] I get a Permission denied (publickey). I tried resetting the root password and logging in via the digitalocean droplet console, but it won't take the root login or password that was reset. Nor will it take the other username and password that I set up.

Everything was working fine yesterday, but when I started work today I ran into the Permission denied issue. So I'm not sure what changed to make this no longer work. I also checked my github keys to see if it hadn't been added, but my local machines key is there and correct. I've also tried adding the key to the droplet with ssh-copy-id [email protected], but got the same error.

Looking at the keys found when logging into the digitalocean website shows the correct key.

Answer

Corey picture Corey · Feb 10, 2018

The issue was on the server-side authorized_keys, but not the ~/.ssh/authorized_keys. It was in a separate /home/user/.ssh/authorized_keys file, where I had to add the ssh-keys. Once I did this the issue went away. Not sure how it got removed from that file since I hadn't modified it. This video helped.