"Permission denied (public key)"

Posted February 22, 2020 708 views
Debian 10


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.

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.

Submit an Answer
2 answers

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.


Show answer This answer has been marked as resolved by marwanamireh.