Skip to content

Instantly share code, notes, and snippets.

@szydan
Created November 18, 2023 20:32
Show Gist options
  • Save szydan/c176be43cd5a1caaf069a229f82b94a9 to your computer and use it in GitHub Desktop.
Save szydan/c176be43cd5a1caaf069a229f82b94a9 to your computer and use it in GitHub Desktop.
Forward port
To connect to a service on a remote server that does not have its port exposed to the network.
For example, to connect to an elasticsearch back end to an investigate demo, incant the following:
ssh -L 9200:localhost:9200 -Nf username@remote.host
You can then connect to localhost:9200 and it will be forwarded to localhost:9200 on the remote machine.
In general, the argument to -L is of the form:
local-port:hostname:remote-port
Note that the hostname is resolved from the remote machine's point of view, and so is usually localhost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment