Setting PasswordAuthentication no causes Permission denied (publickey
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
What the hell?
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.