Unable to Connect after adding second authorization Key

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?


Submit an 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.

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?

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