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.

I like to upload my public key (eg: ~/.ssh/id_rsa.pub) to various servers that I connect to on various networks for work. I use this same public key on Github. If I am on a shared user account and I put my public key there, can someone just take it and do something unfavorable with it? Is it generally not a wise idea to just have 1 Public key that you share amongst several servers?

share|improve this question
1  
Since your key is already at Github, it is possible for anyone to access it: github.com/YourUsername.keys –  Valmiky Arquissandas Aug 5 at 8:48

1 Answer 1

The public key is meant to be disclosed to remote systems. So assuming your key pair is of adequate length, uploading the public key to remote hosts is safe. Only your private key needs to be protected, and that is normally done using the operating system's file permissions facilities as well as a passphrase.

That said, using the same key pair for multiple hosts makes it more difficult to replace if that key is ever compromised, or even if you simply want to replace it on a regular basis to maintain good security hygiene.

As long as everything goes well, it won't be a problem to use the same key pair for multiple hosts or services, but unless you have a specific need to do it that way, I would suggest using different key pairs for each host and/or service. You can specify which key file should be used on a per-host basis through your ~/.ssh/config (see man ssh_config) and its Host and IdentityFile directives (assuming OpenSSH; other clients have different ways of accomplishing the same thing).

And if you are on a shared user account at work, lobby to fix that. Shared user accounts make it nearly impossible to properly secure access and data, and to after the fact see who did something. In fact, I'd argue that there's your problem, not using a SSH key pair for multiple hosts. There are very few questions to which the answer is shared user accounts.

share|improve this answer
    
I recommend using the IdentityFile option with placeholders. That way, it's less of a hassle to introduce new keys. –  Daniel B Aug 1 at 23:02

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.