Question

Can not ssh to my newly created droplet

I just created a ubuntu 18.04 LTS droplet with SSH connection. I am trying to access it from my terminal at local machine by ssh <PUBLIC IP>. but I am getting Permission Denied (public key). I have added the SSH key from id_rsa to my DO account and also added it to the droplet when creating. I did not set any password as I wanted to do via SSH only. When I am trying to access console from the dashboard, it’s asking for password which I did not set. How can I solve this?

I tried to destroy and recreate droplet, but same problem is occurring. How can I fix it?


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
July 28, 2019
Accepted Answer

You need to add your id_rsa.pub key to your DigitalOcean account. Also when you ssh you can use the -vvv option to get more verbose output and see why it fails to connect, e.g

ssh -vvv root@IPAddress

If the ssh is still failing, feel free to paste the output of the ssh connection.

Alex

The above answer doesn’t really solve it in my opinion.

You want to set Authentication to SSH keys

Espescially when creating from the command line you want to specify the --ssh-keys

doctl compute droplet create xxx.co.za --region lon1 --image ubuntu-18-04-x64 --size s-2vcpu-2gb --ssh-keys 1721306

You can get the ssh keys for your account with:


doctl compute ssh-key list

I found similar problem where the ‘Add SSH Keys’ dialog does not update the ‘.ssh/authorizedkeys’ file for root. This must be done manually. However a separate issue is that the DO Console opens a terminal browser window that has a short copy/past buffer (~128bytes). From the terminal window run nano ‘.ssh/authorized_keys’ for root, and update the rsa key by repeating copy/paste multiple times until the entire rsa key value is copied

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.