benifa
By:
benifa

Permission denied (publickey).

June 1, 2017 1.3k views
API Ubuntu 16.04

Whenerver I try to ssh into the droplet after creating a new user, and adding the latter with visudo. SSh connection keep throwing back " Permission denied (publickey)." error.

2 Answers

Once you created user, you need to add SSH key to that user. This is explained in Step 4 of Initial Setup tutorial. As you have your SSH key already, jump straight to Copy the Public Key - Option 2: Manually Install the Key part. Once you're done, you should be to SSH with your new account.

When you start a new server, there are a few steps that you should take every time to add some basic security and give you a solid foundation. In this guide, we'll walk you through the basic steps necessary to hit the ground running with Ubuntu 16.04.

Another suggestion, make sure your /home/youruser/.ssh folder permissions is 700, because if everything else is ok, ssh can not read the public key from .ssh/authorizedkey i think. This worked for me.

Have another answer? Share your knowledge.