Forum archive
Add SSH key-pair
Ok, I'm feeling pretty stupid and vulnerable because I'm not sure how to even phrase this question correctly.
When you launch a new server from the Hub, it allows you to select the SSH key-pair you want to use. I downlaoded an ISO and installed and configured a virtual machine on my local system, and I need to add my SSH key to it. But I have no idea how to do that. Googling tells me how to generate a new key, but I'd like to use an existing one. How do I do this?
What is your host OS? If you're using Linux (or Mac too - I think), then it's pretty easy. If on Windows, then it's a little more of a pain, but still doable. Regardless, I'll detail both below, then others that have the same issue will hopefully find this post too.
Linux (and probably Mac too)
If you are a Mac user and confirm this works, please post so I can update this post.
E.g.:
However, if you are adding your key to a v15.x appliance, you will need to apply a tweak first. FWIW our SSH hardening in v15.x locked things down a little too much; I intend to "fix" that for future releases, but haven't got there yet. The issue (and the workaround) is noted on the relevant issue.
Windows
AFAIK Windows doesn't have a handy utility to take care of that for you, so you need to manually do what ssh-copy-id does for you. Namely copy in your SSH public key (usually found at ~/.shh.ras_id.pub on Linux (not sure where that usually lives on a Windows machine?!) to the remote computers ~/.ssh/authorized_keys file.
In other words, cat the pub key file, copy the text, then paste it in ~/.ssh/authorized_keys file (create it if it doesn't exist). If you have a few keys you'd like to add and already have them added to another server, it may even be easier to copy the authorized_keys file from one server to another via scp. I.e.:
Warning: that will overwrite an existing authorized_keys file. Also users who have keys on server1, can now access server2!