Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Say I have local access to two machines A and B and remote access to machine C.

If I generate a public-private pair of keys for accessing machine C from A, can I share the private key with machine B to access machine C from it? Or do I need to generate a new public-private pair?

At the moment I have a pair of keys working to access C from A, but when I use this private key from B it doesn't work.

In case it matters, I use a config file for this as follows:

Host XXX
User XXX
HostName XXX
IdentityFile ZZZ

Where ZZZ points to the key in B (different paths in the machines A and B)

I am using the same username in both.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You always can. I think C will have your public key (outside) and, if A and B are both inside a local network (ie: your home network), you are not doing something risky by sharing, unless you use internet to send it unencrypted xD. If A and B are machines you own and you can be sure that nobody can read your private key, then you can share a private key with no risk.

The thing is that your private key must never be compromissed. Ensure you have a revoke certificate generated and printed, and the public key in a keyserver, so anyone can just refresh it to see new signatures and revoke certificates.

I will give you an example. I have a GitHub account, and I access it from SSH from my machines at home. I have more than one machine, and more than one OS inside each machine, but I use only one key for GitHub. Why? Well... I have my key in personal, encrpted drives. Nobody can see my private key, no matter how much copies I own.

Hope it'ill be helpful Cheers

share|improve this answer

Regardless the user name you use, you can copy the private key from A to B without any problem. It works and there is IMHO no problem with that.

I also do it this way. For security reasons you should ensure that every private keys is protected with a passphrase.

share|improve this answer
    
I think that depends on the interpretation of "user". Is it the OS user? is it the remote OS user? is it the User ID of the GPG/PGP key? –  D4RIO Jan 13 '12 at 19:56
    
I only referenced to the user name that points the user's OS user name. You can also use different GPG keys to access C... –  tuergeist Jan 15 '12 at 18:13

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.