Report this

What is the reason for this report?

Cannot ssh between 2 droplets nor to localhost

Posted on April 23, 2019

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



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!

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.

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

This comment has been deleted

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.