Setting up ssh config file with id_rsa through tunnel
Posted
by
Rubens
on Server Fault
See other posts from Server Fault
or by Rubens
Published on 2012-11-23T19:26:50Z
Indexed on
2012/11/23
23:06 UTC
Read the original article
Hit count: 224
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:
ssh final
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 LocalForward
and/or 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.
Hope somebody can help me here!
Regards!
P.S.: the thread I've tried to get some help from:
http://www.linuxquestions.org/questions/linux-general-1/proxycommand-on-ssh-config-file-4175433750/
© Server Fault or respective owner