1

How can I establish a reverse ssh tunnel with my ./ssh/config file?

I'm trying to reproduce this command

ssh [email protected] -L 4444:restricedserver1.org:4420 -L 4445:restricedserver2:4430

2 Answers 2

1

Yes. The option is called RemoteForward with a bit different syntax.

But in your example, you are using LocalForward, which would look like this in ssh_config:

Host dmx.com
  User admin
  LocalForward 4444 restricedserver1.org:4420
  LocalForward 4445 restricedserver2:4430
1

You don't need a tunnel. Use ProxyCommand instead:

Host restricedserver1
    HostName        restricedserver1.org
    User            admin
    Port            4420
    ProxyCommand    ssh -A -q -l %r -W %h:4444 dmx.com
    ControlMaster   auto
    ControlPersist  5m

and similar for the other host. The advantage over a tunnel is that you don't need to keep it up all the time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .