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

share|improve this question
add comment

4 Answers 4

up vote 5 down vote accepted

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:

http://www.gentoo.org/doc/en/keychain-guide.xml

share|improve this answer
    
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
add comment

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.