I have a single computer running OS X, XP, and ubuntu. Though, sometimes it's running multiples of those OS in VM or actual installs. I have a couple of servers I need to constantly SSH into - but sometimes I change hosts or wipe the servers.

At any rate I'm tired of setting up new SSH key pairs every time I use a new OS or server. All the information on those servers is on my PC - so if someone found me out here, made it pass all the guard dogs, and stole my PC they won't need to break into my severs since none of the operating systems I'm using have file encryption on (I'm not even sure how to turn it on).

How can I sync my key-pair to all the OS I use on this PC? On windows I use Putty/Pageant while Snow Leopard and Linux have native SSH. So the file formats aren't exactly the same.


I generate all my keys on linux using ssh-keygen -t dsa and it works just fine with Putty/Pageant and SSH under Cygwin on windows. You don't need to have separate key pairs for each server. You just copy your public key to each server you want to log into. You say the file formats aren't the same but in my experience they are, but it's the filenames and paths that differ. If you really have to copy the keys over a lot I'd create a separate bash script for each OS to automate the public key propagation.

In order to keep your private key safe even if someone does "steal your pc" you need to password encrypt it. If you don't like constantly entering a password use a utility like keychain so you only have to decrypt your private key once per session. It works kind of like sudo...

Try following this howto:


  • I don't use KDE or Gentoo. However, it seems that on OS X and linux I need to ssh-add before I start any SSH sessions and then on windows I need to start pageant so that putty uses the key that pageant has loaded. – Xeoncross Jan 25 '11 at 22:32

Would the "ssh-copy-id" command help?

  • I'm not quite understanding how that works. So would I have the private key on some server and then run that from each client OS I use to download the private key? – Xeoncross Jan 25 '11 at 22:34
  • You have to already have a private key, but it automates adding the public key to any hosts that you list. – edgester Jan 26 '11 at 18:25

What you're essentially asking is: "how do I sync files across multiple OS's?"

Small: Maybe Dropbox with a small (os specific) shell script (to auto install the ssh keys). The choices here are more numerable than bike shed colors.

Medium: a git server that houses your keys would be a nice way to go, and even allow you to have a history of all your keys.

Large: Puppet of course would be even better (but only if you're willing to use it, and won't support windows (directly)).

Putty can generate keys and load them as well.


Create a VCS repository somewhere (git/svn/whatever) that you feel is secure. Check your keys in, and then checkout everywhere you need it. Add a login script to update/check-in changes automatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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