FIX "Permission denied (publickey)." SSH Error in DigitalOcean!

I recently created a new Droplet in DigitalOcean for our upcoming Discourse Forum, I used macOS’s Terminal and used the SSH details to log in, but I kept getting this error:

Permission denied (publickey).

FIX "Permission denied (publickey)." SSH Error in DigitalOcean!

It’s been a while I created a new Droplet in DO and I was confused why this happened, because last time this didn’t happen. But after Googling a bit, I figured out a simple way to overcome this error. Here is our solution:

  1. Open your DigitalOcean account and go to your Droplet.

  2. Go to Access > Reset root password. You’ll get a new password in a while. Copy it.

  3. Launch the “Console” access and enter the login details. Enter “root” and the password you got in the email. You can copy/paste it I guess.

  4. Type: nano /etc/ssh/sshd_config

  5. Go to PasswordAuthentication and change the value from no to yes

PasswordAuthentication no to yes DO SSH

It should look like this. Save this file.

  1. Type: service ssh reload

That’s all. Now you can go to your SSH client and log in as ssh root@ipaddress

Do let us know if you have any queries. Thank you!