Question

Permission denied (publickey).

Posted June 1, 2017 23.5k views
APIUbuntu 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.

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.

×
2 answers

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.

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.

by Mitchell Anicas
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.
Submit an Answer