Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So far I've created a separate SSH key for each server I need to login to (for each purpose, to be more accurate). I did it out of a sense of security, just like different passwords to different sites.

Does having multiple SSH keys actually improve security? All of them are used from the same machine, are located in the same ~/.ssh, most even have the same passphrase.

So... should I give up the whole system and just use one SSH key for everything?

share|improve this question

4 Answers 4

up vote 15 down vote accepted

SSH keys use public-key cryptography. That means that what you're installing on all those servers is just your public key, which you want the whole world to know. The only actual secret is your private key that you keep locked down on your own machine. So yeah, I'd say you're wasting your time.

share|improve this answer
12  
I think there are valid reasons to have separate keys, and this would not be a waste of time. In the case of a compromised key, the risk with this is reduced. The password should be different for each key, I agree. –  jfmessier Mar 18 '10 at 16:19

No it is not a waste of time to use more than one key.

More diversity == less risk.

That statement of Spiff's is incorrect.

The point is the public key grants access to the private key holder and no one else.

The risk to be concerned about here is authentication. A rogue site forwards authentication requests to your agent task. If you use only one key, then even when only one key is loaded in your agent, all sites are open to the rogue.

This has nothing to do with the passphrases, you could have several keys with the same passphrase that would make no difference here. Because it is not the passphrase that is compromised.

The rogue forwards challenges to your agent and can connect to all sites for which you have keys loaded. With different keys, one key loaded -> one site at risk.

I say good for you, you picked other peoples privacy over your own laziness.

P.S. the moral of the story is be wary of agent forwarding

share|improve this answer
    
Suppose I generate three SSH keys, one for each of three servers I log in to regularly. One day, after I've already logged in to all three (meaning that ssh-agent has cached the passphrases for all three keys), then by your argument, if my ssh-agent becomes compromised, all three log ins are compromised. In such a case, having multiple SSH keys has not protected me. Have I understood you correctly? –  sampablokuper Apr 23 '11 at 6:17

I think there is one good use-case for multiple public keys, and that's if you have private keys stored on computers in different areas of trust. So I generally keep one key that is my "work" key, and another that is my "home" key, simply because the private key for my "home" stuff is not stored on my work computer and vice versa.

share|improve this answer

Ultimately this is up to you. You need to evaluate your threat model. How likely is it that one of your keys is compromised? If one key is compromised, how likely is it that the other keys will be compromised? What are the consequences of your keys being compromised? What is the cost (including time) of managing multiple keys?

Considering factors such as these should help you decide if you really need separate keys. On my personal machines on my local network I usually don't bother with extra overhead in trying to manage multiple keys. However, outside of my network I would use different keys each with a unique passphrase. But that is just my personal opinion.

share|improve this answer
5  
+1 for "evaluating the threat model". This is just the point. –  sleske May 17 '10 at 8:45

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.