ProxyCommand - SSH Key on Proxing Machine

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hey all,

I have a setup like this

My machine: ssh ->> Gateway (has a private key in .ssh/id_rsa): ssh ->
Another machine (using the key on the gateway box)

That's how things are done now. What I would like to do is use a proxy
command so I can ssh to a certain machine through the gateway without
having to manually ssh in to the gateway. The current setup is working
good, except it never offers the ssh key on the gateway machine. Is
there any way to do this without putting the gateway ssh key on my
local machine? Here is my proxycommand

ProxyCommand ssh gateway exec nc %h %p

Re: ProxyCommand - SSH Key on Proxing Machine

Justin schrieb:
Quoted text here. Click to load it

I think, you can simply write

ProxyCommand ssh gateway nc %h %p

sometimes i have seen

ProxyCommand ssh gateway nc -w 1 %h %p

to make sure, nc terminates after the ssh-session has finished. The key
on the _gateway_ is never needed since there is no ssh running on the
gateway. There are two instances of ssh running on your local machine.
Therefore, the key is needed on your local machine.

If the user at the ssh-server behind the gateway and the user at the
gateway both have your public key in their authorized_keys, then only
one key is needed.


Site Timeline