Question

Cannot ssh between 2 droplets nor to localhost

I have public keys setup for droplet creation and i am able to remote into both droplets from my computer using the key pair but if I try to ssh from Droplet 1 to Droplet 2 it fails with the following info:

Apr 23 15:03:21 18 sshd[18270]: Connection closed by authenticating user root 127.0.0.1 port 38042 [preauth] Permission denied (publickey).

This happens on both droplets and even when connecting to localhost on the same Droplet.

UFW is disabled and sshd_config is set to the default that DO sets it to when it creates a droplet with a key file.

I have dug through everything i can find but i cannot get past this error.

Both droplets are using ubuntu 18.04


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.

This comment has been deleted

Greetings!

This means that the server you are connecting to only accepts SSH key login, and the public key for your SSH key pair does not exist in /root/.ssh/authorized_keys no that other server. If going from Droplet1 to Droplet2, then Droplet2 needs to have the public key from Droplet1 in it’s authorized_keys file. The same goes for the other way around. Here you can find some documentation on creating SSH key pairs:

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-openssh/

Jarland