Skip to content

Instantly share code, notes, and snippets.

@julianlam
Last active April 21, 2022 20:10
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 julianlam/da351738023b13330921e0ac0ec15d95 to your computer and use it in GitHub Desktop.
Save julianlam/da351738023b13330921e0ac0ec15d95 to your computer and use it in GitHub Desktop.
Forward port from remote server to local machine #blog

This is how to do it, because I have the memory of a goldfish and have to look it up every time.

The context

Let's say there's a server (123.123.123.123) running a service on port 1234.

You want to view it on your local machine on port 2345.

The command

ssh -NL 2345:localhost:1234 root@123.123.123.123

Adjust port numbers, username, remote IP, etc. as necessary.

... and then

Browse to localhost:2345.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment