problems applying ssh keys with Ubuntu 18

November 27, 2019 110 views
Ubuntu 18.04

Right, so before you send the link I have been following this step-by-step

I got to the section where it says

Now you will be in your new user’s home directory.

Create a new directory called .ssh and restrict its permissions with the following commands:

mkdir ~/.ssh
chmod 700 ~/.ssh
Now open a file in .ssh called authorized_keys with a text editor. We will use nano to edit the file:
$ nano ~/.ssh/authorized_keys

however I don’t have that file name in that directory so I created it and pasted my pub ssh key in there as it says, and then followed the tutorial to the end and where it says that I could sign in I tried to and I still get the error:
christian@<ip_addess>: Permission denied (publickey).

but then I noticed it was Ubuntu 16, and I have 18. So I switched to the docs about Ubuntu 18 and there isn’t anything about setting the key, just the firewall. So I am kinda in limbo as to what I can do

at step 5 it says that if password is enabled (which is it) then I can sign in with christian@<ip_address> which I can’t because I get the error stated above

I can do: $ ssh root@<ip_address> then enter a password
but I cannot do
$ ssh christian@<ip_address> because of Permission denied(publickey). So I don’t know how to resolve this.

thank you!

1 Answer

Hello, @jsBarna

I will recommend you to check this tutorial on how to setup your ssh keys on Ubuntu 18:

Have in mind that you can access your droplet using the console from the control panel and add/enter your key from there.

Let me know if you have any questions.


by Hanif Jetha
SSH-key-based authentication provides a more secure alternative to password-based authentication. In this tutorial we'll learn how to set up SSH key-based authentication on an Ubuntu 18.04 installation.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!