Machine1 has private and public pair. Machine2 and machine3 have public key.
I go to machine2 from machine1 over ssh and then I want to go to machine3 from machine2. It's like that machine1--ssh-->machine2--ssh-->machine3 How can I do that?
You might want to check out keychain, too.
Lets clarify this: the user you are establishing these connections as has a public/private key pair. In ~/.ssh/authorized_keys on machine2 and machine3 there is a copy of the connecting users public key?
If this is the case then on machine1 you should be running an ssh-agent to cache the credentials for your key. Here's what it looks like when I set up an ssh agent and cache my key:
(You only need to run eval
Then when I make SSH connections I run the ssh command with the
Except I don't do that all the time, my ~/.ssh/config file is configured to forward my agent automatically:
If you run your ssh commands like this then your agent will be with you on
If you want to login from one machine to another without a password, you need to use
The way to do it to create the key pair and then copy the public key to each server you want to have access. The file should be copied to
Here are required the steps:
1- Create key pair on machine1.
2- Copy the generated public key to machine2.
3- Create another key pair on machine2.
4- Copy the generated public key to machine3.