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 XXXUser XXXHostName XXXIdentityFile ZZZWhere ZZZ points to the key in B (different paths in the machines A and B)I am using the same username in both.
Sharing private keys across machines
ssh
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 helpfulCheers