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):

What the hell?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.