Question

Setting PasswordAuthentication no causes Permission denied (publickey

Posted November 7, 2018 960 views
DigitalOceanUbuntu 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?

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.

×
1 answer

Hello, @deltar7

I hope this has been sorted, but I would ask if you an confirm that the changes you made in the /etc/ssh/sshd_config file were removed/reversed every time you had this issue? If the key is added fine and if /etc/ssh/sshd_config is configured to access key authentication the you wont get a password prompt when you try to login.

Submit an Answer