Ssh – How to configure ssh to automatically port forward to another computer

port-forwardingsshssh-tunnel

I found the permit_open option in authorized_keys, but I want the particular user to ssh to the server and automatically telnet to another user and being jail-boxed at the same time. It means something like:

user1@local# ssh user1@remote1

it actually connects to a remote2 telnet port behind a firewall, and user1 is not able to access anything(incl. remote1) behind the firewall.

Best Answer

You would use port forwarding, or a firewall rule (ipchains, or similar). I think you're looking at SSH expecting to do this, but that's not what SSH is for.