Question

problems applying ssh keys with Ubuntu 18

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!


Submit an answer


This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
November 27, 2019
Accepted 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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel