3

Let's say I create SSH keys in a Mac to connect to my remote server.

My server has my public key. My Mac has my private key.

So far so good.

A few days later, I want to connect to my server by using my Windows PC (WinPC).

It seems to me that there should be 2 ways to connect via my WinPC:

  1. I should be able to copy my private key over from the Mac to the WinPC and use the private key there. (Update: Is it necessary to convert the Mac keys from OpenSSH to some other format -- e.g. PPK -- for using in the WinPC, or is that not necessary any more?)
  2. I should be able to generate new SSH keys on my WinPC, and load the new public key to my server.

My questions are:

  1. Am I correct that both the above options are available?

  2. Which is the superior option in general (if any)?

3
  • 2
    You're correct you can copy your private key to another PC, and you can also have multiple public keys on a server. The key pair will work together regardless of hardware. As far as which is better, the purists will probably say generate a new key pair for every connection, personally I'd end up too confused. On the other side of the coin if you always use the same key pair and your private key gets compromised then you might have a lot of public keys to change quickly.
    – Tyson
    Apr 25, 2015 at 2:55
  • @Tyson Thanks. Supposedly, Mac uses OpenSSH, and those keys need to be converted to some other format (e.g. Putty PK) in WinPC. Have you ever tried using the same keys across Mac and WinPC. Did you need to convert them (from OpenSSH to something else)? Apr 25, 2015 at 13:54
  • not too sure about the winpc part (putty wise) but to piggy back on @Tysons post there are options to decleare both hostnames( or grab from /etc/hosts) and or groups (similar to workgroups as i understand it) that could be used Apr 25, 2015 at 19:18

2 Answers 2

1

Both options are valid.

The format is dictated by the ssh client you use on Windows.

In general you don't want to spread your private key to many machines. The preferred option is to generate a new keypair for each machine and add the public key to the server.

1

Your assumptions are basically correct. If you're using PuttyGen (I believe you are, since you reference PPK files) then yes, you'll need to convert between the different formats.

If you create the key on the Mac, the private key will be in OpenSSH format (or should be) which PuttyGen will allow the importing of. Similarly, if you create the keypair in PuttyGen, you can save the PPK locally, but also export the private key into an OpenSSH format. You'll need to copy that exported file to your desired client (and likely rename to the default id_rsa or specify the desired IdentityFile option in your ssh client string).

joey

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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