SSH tunneling Client -> Gateway -> Target

I find myself working on a laptop but needing a TCP connection to a targetserver which is hidden through another network, where $gatewayServer is the door I need to go through in order to reach the target.

No probs, ssh can help you!

This is your command, run it in the background

ssh -L $portOnLaptop:$targetServer:$portOnTarget $gatewayServer

Then you can connect to localhost:$portOnLaptop and it will behave as it you would have connected to $targetServer:$portOnTarget

Show your support

Clapping shows how much you appreciated Laura Dietz’s story.