Question

Struggling to set up SSH

I have been following the SSH tutorial, but it hasn’t been working for me.

I made a public key and I put it into the my droplet on the security panel of Digital Oceans.

I checked in .ssh/authorized_keys and the same public key is indeed there. And yet, I can’t secure the SSH connect such that I can use SCP or SSH without a password. I’ve tried many tutorials and debugging articles about this, and I can’t get copy-ssh-id to function with or without -i with changes in config, etc…

is this a common problem? Any ideas?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, @tapinoma

You can make sure that you’re using the droplet’s IP address in the ssh connection in case there is a problem with the hostname’s DNS.

You can also double-check the SSH tutorial.

https://docs.digitalocean.com/products/droplets/how-to/connect-with-ssh/

Use a terminal on a Linux, macOS, or Windows computer to connect to Droplets with SSH.

https://docs.digitalocean.com/products/droplets/how-to/connect-with-ssh/openssh/

Use PuTTY on a Windows computer to connect to Droplets with SSH.

https://docs.digitalocean.com/products/droplets/how-to/connect-with-ssh/putty/

Regards, Alex

Hello,

What I could suggest is running the SSH command with the -vvv flag so that you could get some more information on why the SSH connection is failing:

ssh -vvv root@your_ip

Also on another note, what SSH client are you currently using?

Regards, Bobby

Thanks everyone for your thoughtful responses. This issue was solved.

Three steps seemed particularly useful for the solution:

  1. I generated key again, this time using ssh-keygen -t ed25519 instead of ssh-keygen. Not sure why that made a difference, but I’ll explain difference in a second.

  2. I did not post the “comment” at the end of my public key [user]@[location] into digital oceans storage of keys

These differences seemed small, but after doing this, when I ssh’d it would ask for my key passphrase instead of my user’s password, which seemed to indicate it took to my key. This may have solved my ssh/scp issues

or maybe, it was purely #3, which was silly: #3. I had been trying to SCP into a file for which I was not the owner, I had to A . change the permissions (which I did), or B, SCP to where I am the owner then move with sudo mv [file in current location] [final location] to get it to where I wanted to go. Apparently the server I had got from the marketplace had purposely changed the owner to nobody for the server directories I was trying to work with

Other weird (maybe obvious to most?) things i learned along the way:

  1. When I “copy path” of item on my computer, it comes with quotes, C: and back slashes. for scp path, I need to strip quotes, C, and change back slashes to forward slashes

  2. Obvious in retrospect, but to SCP I need to NOT be ssh’ed on the server but on my local cli