I have a VM running Ubuntu Server 18.04 on my local network. This local VM is not accessible outside my network. I want to connect this VM to my Droplet.

I already have an ssh key for this droplet, and I am able to connect no problems.

I created a new key on my local VM. Knowing that I could not connect to the Droplet from this VM, I copied and pasted my new key below my original key in authorized_keys.

However, even after a reboot, I am still unable to connect my VM to my Droplet. I am still able to connect to my Droplet using my first key.

What am I doing wrong?

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.

×
2 answers

Hi @aaronmweiss,

What error do you get? Additionally, if checking the /var/log/messages or /var/log/secure do you see anything?

You should be able to see some errors there. Additionally, what I’m thinking is it’s most probably related to the key itself. Are you sure you’ve copied the .pub file? One other thing, maybe you’ve copied over only part of the SSH key file.

One last question, you mentioned you created the SSH key on the VM but how exactly are you accessing your local VM, is it via virtualbox, vagrant or something else?

Regards,
KFSys

  • I didn’t reply directly to your thread, but I’ll copy/paste from below and add additional info.

    I do not have any /var/log/messages or /var/log/secure on either server.

    The error I get is (info redacted):
    user@XXX.XX.XX.XXX: Permission denied (publickey).

    I copied and pasted from my the contents of my VM’s .pub file from “ssh-rsa” all the way to the end of the comment. The key was generated on the VM with ssh-keygen -t rsa

    My VM is a byhve VM on a FreeNAS sever. I access this VM via ssh on a Bitvise client. My goal is to obtain logs from my Droplet to this VM so they can be ingested by Graylog.

    I did disable key-only login which did allow my VM to connect to my Droplet. However, that isn’t an ideal, permanent solution. During that time, I did a ssh-copy-id and I got a message saying that the key already existed. I went ahead and forced the key copy just to be on the safe side. Once I re-enabled ssh authentication on the Droplet, I received the same Permission denied (publickey) error.

I do not have any /var/log/messages or /var/log/secure on either server.

The error I get is (info redacted):
user@XXX.XX.XX.XXX: Permission denied (publickey).

I copied and pasted from my the contents of my VM’s .pub file from “ssh-rsa” all the way to the end of the comment. The key was generated on the VM with ssh-keygen -t rsa

My VM is a byhve VM on a FreeNAS sever. I access this VM via ssh on a Bitvise client. My goal is to obtain logs from my Droplet to this VM so they can be ingested by Graylog.

I’m thinking maybe creating the key on the Droplet and copy/pasting to the VM?

Submit an Answer