How can I establish a reverse ssh tunnel with my ./ssh/config file?
I'm trying to reproduce this command
ssh -R 55555:localhost:22 user@host
in my .ssh/config file so that when I type ssh host
I'll ssh to the host as user and with a reverse tunnel. The commands accepted by the config file are more verbose counterparts to the command line flags. Based on the ssh manpage and the manpage for ssh_config, it seems like the corresponding setting is BindAddress.
In my .ssh/config file I have:
Host host
Hostname host
User user
BindAddress 55555:localhost:22
This, and slight variations of, result in a connection refused when I try
ssh localhost -p 55555
once logged in on the host. The same works fine if I explicitly give the command at the top when first sshing to the host. My config file does work without the reverse tunnel command; ssh host
logs me into host as user.
Best Answer
BindAddress
is not the option you're after. Fromman ssh_config
:The configuration file equivalent of
-R
isRemoteForward
:With this information the command line
translates into the following
.ssh/config
syntax: