Options for SSH port forwarding

linux

Forward connection to localhost:8080 to example2.com:80 through example.com. This is generally used when the target server cannot be accessed directly from the local or when the port is not open to the public.

  • -L: Do port forwarding
  • -N: Don’t execute commands
  • -f: Run in the background
$ ssh [email protected] -Nf -L 8080:example2.com:80 
$ curl localhost:8080 # => example2.com:80