On 29/06/11 11:46, ShibuThomas wrote:
HI all.
I want to do ssh login into two different mechines on by one.I tried the
following squence.but it is not working correctly.
For Ex I have 3 mechines Host1,Host2,Host3.
I need to login into Host2,Host3 using SSH from Host1.
I tried the following:
step 1:
-logged into Host 1
-execute ssh localhost
Why, you are already logged into host1?
-execute ssh-keygen -t dsa
-execute scp ~/.ssh/id_dsa.pub Host2:.ssh/authorized_keys2
-exectue ssh -l root Host2
not get the prompt for password.
Ok, so now you have a private key on host1, and the corresponding public
key on host2.
Then I tried to connect to Host3
step 2:
-logged into Host 1
-execute ssh localhost
-execute ssh-keygen -t dsa
You just created a new public/private key pair, overwriting the keys you
previously created (which you need to logon to host2).
-execute scp ~/.ssh/id_dsa.pub Host3:.ssh/authorized_keys2
-execute ssh -l root Host3
not get the prompt for password.
Ok, so using the new public/private key works for host3.
But after this I tried to connect Host2 from Host1 using
-ssh -l root Host2
I got the prompt for enetring pasword.
Because you overwrote the private key on host1 which is needed to
connect to host2 using the public key on host2.
Is anyone know how to rectify this.
Copy the new public key to host2
-log into Host 1
-execute scp ~/.ssh/id_dsa.pub Host2:.ssh/authorized_keys2
All you needed to do at step 2 was copy the same public key to host3,
just as you had already done for host2.