Question

problems applying ssh keys with Ubuntu 18

Posted November 27, 2019 384 views
Ubuntu 18.04

Right, so before you send the link I have been following this step-by-step
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04#step-four-

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

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04

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!

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.

×
1 answer

Hello, @jsBarna

I will recommend you to check this tutorial on how to setup your ssh keys on Ubuntu 18: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804

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.

Regards,
Alex

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