Skip to content

Instantly share code, notes, and snippets.

@rbrooks
Created March 19, 2012 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbrooks/2124882 to your computer and use it in GitHub Desktop.
Save rbrooks/2124882 to your computer and use it in GitHub Desktop.
SSH - Forward Tunnel
# Use Case
# --------
# You have solely SSH (port 22) access to a box on a remote LAN.
# You have no Admin access to the firewall to forward ports.
# You need to browse the website on the box via a Web browser.
# From your local, desktop machine:
sudo ssh -NL 80:localhost:80 root@<IP or hostname>
# Note the first password you are prompted for is your own [because of the `sudo`].
# It will just sit there, appearing as if it's doing nothing.
# Browse http://localhost in your browser. You should see the site that was behind the firewall.
# `-N` - Just set up the tunnel. Do not prepare a command stream.
# `-L` - Local. Create a "Forward Tunnel". Forward local port 80 to remote port 80 via SSH (which is on port 22).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment