"Permission denied (public key)"


Whenever I create a Debian 10 Droplet, I am able to access root using my SSH key just fine. But when I need to setup a non-superuser account and SSH to it, using this guide by DigitalOcean, it keeps on telling me that “Permission denied (public key).” I have followed every step of this guide. I have tried this solution posted here before, but PasswordAuthentication is off for me. You can see my sshd_config here. Can anyone please help me?

Thank you.

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

I think DigitalOcean updated the image, because the issue fixed itself recently.

Hello, @amirehmarwan

If you’ve added/copied the .ssh folder into the non root user’s home directory as mentioned in the article:

cp -r ~/.ssh /home/sammy
chown -R sammy:sammy /home/sammy/.ssh

This should work fine. However you can try to ssh by adding -vvv to your ssh command in order to get/receive a more verbose output, e.g:

ssh -vvv user@DropletIP

The provided output should help you to find out why the connection is failing and then we can further troubleshoot the connectivity issue.

Let me know how it goes.

Regards, Alex