SSH tunnelling – TCP port forward from local dev to public facing ssh server

A little bg story: I’m writing a rails app, which is hosted inside the corporate network, and no incoming traffic is permitted. I need to expose the internal port 3000 to the public.

Short answer: SSH forwarding.

For some reason, the forwarding only works when I set both the local and remote port as 3000.

There is one more thing you need to do to enable this. SSH doesn’t by default allow remote hosts to forwarded ports. To enable this open /etc/ssh/sshd_config and add the following line somewhere in that config file.

Make sure you add it only once!

And restart SSH

Source:
http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding

Leave a Reply

Your email address will not be published. Required fields are marked *