I have accounts on two machines: H1 and H2. I created ssh keys on H1 and installed it on S1. I can now ssh to S1 from H1. I want to do the same from H2. How do I install the ssh keys generated on H1 on H2?
migrated from stackoverflow.com Sep 6 '11 at 15:42
This question came from our site for professional and enthusiast programmers.
Edited: If you own both machines, you may share your private key. But this solution is not safe for case of stolen notebook or for machines you don't own.
You may copy your private keys from H1 to H2, if you want to use the same private key to be able to login from H2 to S1. When you at H1 do the commands:
Warning! This will delete and replace any private key you had at H2.
Better way is to generate new private keys on H2 (
Use two private keys
Set up H2 using the same process (but not the same private key) as you did when you set up H1:
(but use your actual username on S1 and S1's hostname, and later type in your password on S1 when it asks for it).
This installs the public key of your workstation into the
I assume that what you are really asking is
What is the right way to do that?
People have it hammered into their head that one account on a server has a single username and, of course, a single authorized password.
Public-key systems like ssh are better than the password system:
One account on a server has a single username and any number of authorized public keys, all of them listed in the