Today I redeemed Digital Ocean’s offer from the GitHub student pack, which gave me 100$ worth of credit for the next one year, which will be enough for me to learn self-hosting.
I created a basic droplet using a non-root user and generated an ssh-key for login; however, I was getting an error “[email protected]: Permission denied (publickey).” After reading a lot of blogs yet, I was not able to find the solution. After that, I tried login in using a password it worked. But i wanted to use SSH for login.
Then I repeated the same process with the root user as I did with a non-root user, and it worked I was able to log in. Then I thought I must be missing something with non-root user in the end, upon careful examination, I found out that when I sudo for ssh, I always got “Permission denied (publickey)” and when I did not use it I get a prompt for entering a password which I thought to be my non-root user’s password. However, it was prompt for entering the passphrase for the ssh key as I used the passphrase to generate the key. And somehow I missed that I was getting a prompt for a passphrase. As I entered the passphrase I was able to log in.