Setting PasswordAuthentication no causes Permission denied (publickey

November 7, 2018 82 views
DigitalOcean Ubuntu 16.04

I'm having so much trouble with SSH. The only work around I've been able to use to access my droplet is to ssh-copy-id my public key to my server. Then reset my PW on the console.

Once the key is confirmed, I can SSH in locally, but still need a PW. At this point I go to /etc/ssh/sshd_config and change PasswordAuthentication no. The next time I try to SSH I get the dreaded Permission denied (publickey). Repaste the key in authorized_keys and make PasswordAuthentication yes and it will work again.

I was just using it with SSH and PW but it got hacked so that is no longer an option. Problem is, with the PW off I cannot get in at all.

I wrote both of these about the issue, and contacted support (tumble weeds from support): https://stackoverflow.com/questions/52917470/permission-denied-publickey-digital-ocean/52972508?noredirect=1#comment92856534_52972508
https://serverfault.com/questions/938870/rampant-permission-denied-publickey-mac

What the hell?

Be the first one to answer this question.