Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I mostly work on windows. I have a public\private key which I use with git source control(github n other repos). Now, I want to use same keys from a linux machine. I have setup a virtual machine on windows with ubuntu. Can I use the same keys? How do I copy them to the linux instance?

share|improve this question
1  
Are they OpenSSL keys generated with a tool like ssh-keygen? –  Kyle Smith Jun 9 '11 at 17:32
    
I had used puttygen to generate in SSh-2 RSA format –  jess Jun 9 '11 at 17:42
    
I seem to have got it working but it won't accept the passphrase I used on windows –  jess Jun 9 '11 at 17:47
    
this link has steps which solved my problem. stackoverflow.com/questions/2224066/… –  jess Jun 10 '11 at 4:20

4 Answers 4

You do not want to share the same key with another machine. No, you don't, really.

Each private key should be restricted to one user on one machine only. Do not copy private keys around, since by doing this you are exposing your key to an increased risk of it being stolen or inadvertently copied via untrusted channels, or left on untrusted storage devices.

What you should do is generate a new key pair on the new machine, then transmit your second public key to github. Any decent SSH-based service that allows the use of PKI also allows you to store multiple public keys, github is no exception. Give suggestive names to each key (for SSH keys, they are in the form of "username@hostname") so that you know the device associated to each public key.

This has the benefits of keeping your private keys safe, and you can revoke keys individually when only one of them is compromised.

share|improve this answer
    
Why is it such a big deal? I mean, am I the only one who uses a strong passphrase and an agent? I am just curious here if you different keys with strong passphrases for every box you have. For me that is a lot and sometimes I need a little convenience in my life. I am just curious about others like you, because what you said is definitely the little voice in my head when I know I should "know better." –  ajstein Jun 9 '11 at 19:14
    
Has got the answer spot on. The reasons why you should never move a private key are described in the 2nd and 4th paragraphs. –  psp Jun 9 '11 at 19:21
    
@alharaka: I'm unable to understand your concern. Strong passphrases are mandatory, of course, and an SSH Agent actually helps a lot with the key management when you have multiple key pairs. For example, to manage the servers at work, I need a key that is only in my work computer, not in my laptop. But the key in my laptop allows me to connect to my work computer. If I have to connect to the servers from my laptop, I can SSH into my work computer, load its keys into my laptop's SSH Agent, then I can connect to the servers from my laptop. –  Juliano Jun 9 '11 at 19:28
    
I get what you mean. My point here is, let's say I originally configured Github to work with a USB key and different types of SSH clients loadable from the USB key in the event I was not at a computer that was customized by me the way I like. In the event someone steals my USB key, what will they do with the private key? With the passphrase, it is not that useful anyway, and I can trash it for a new one. Reusing my SSH key is potentially dangerous from a theoretical viewpoint, but I have always felt practically the real risk is limited. Then again, I am not discussing work stuff. –  ajstein Jun 10 '11 at 9:21
    
@alharaka The point of using passphrase-protected keys is so that if either the key or the passphrase is stolen, it will only result in a partial compromise, which doesn't give the thief access to the system. With the passphrase set, you have time to revoke the key before the attacker has full access to the system. But having a key in a USB stick and plugging it in any computer you may not trust is inherently dangerous practice. You may have an emergency one-time key in a USB stick, that you revoke as soon as you have to use it once. –  Juliano Jun 10 '11 at 14:00

Most virtual machines (e.g. VMWare, VirtualBox) support file shares between host and VM. Create a file share on the host, mount it in the VM and you have an easy way to share files between the two.

If your key doesn't work, it's probably because it is actually a putty key. You need to use puttygen to export this into a ssh key.

share|improve this answer

I like the first answer, use puttý´s scp tool, or also another easy way would be to copy the keys to flash drive from windows, and then connect the flash drive to the VM instead, if that is possible with your VM software.

share|improve this answer

-SCP (PuTTY)

-Use a SMB share that's accessible to both machines and transfer it that way

-FTP server

Then you always have the "I have no idea what I'm doing" methods like uploading the key to google docs on the windows machine and then downloading it on the linux machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.