I've been struggling to set up a valid configuration to open a connection with a second machine, passing through another one, and using an id_rsa (which requests me a password) to connect to the third machine.
I've asked this question in another forum, but I've received no answer that could be considered very helpful.
The problem, better described, goes as follows:
Local machine: user1@localhost Intermediary machine: user1@inter Remote target: user2@final
I'm able to do the entire connection using pseudo-tty:
ssh -t inter ssh user2@final
(this will ask me the password for the id_rsa file I have in machine "inter")
However, for speeding things up, I'd like to set my .ssh/config file, so that I can simply connect to machine "final" using:
What I've got so far — which does not work — is, in my .ssh/config file:
Host inter User user1 HostName inter.com IdentityFile ~/.ssh/id_rsa Host final User user2 HostName final.com IdentityFile ~/.ssh/id_rsa_2 ProxyCommand ssh inter nc %h %p
The id_rsa file is used to connect to the middle machine (this requires me no password typing), and id_rsa_2 file is used to connect to machine "final" (this one requests a password).
I've tried mixing up some
RemoteForward fields, and putting the id_rsa files in both first and second machines, but I could not seem to succeed with no configuration whatsoever.
P.S.: the thread I've tried to get some help from: