Skip to content

Instantly share code, notes, and snippets.

@vicradon
Last active May 29, 2024 03:13
Show Gist options
  • Save vicradon/5e6ceb22ef3281bdcd09e1dabde37334 to your computer and use it in GitHub Desktop.
Save vicradon/5e6ceb22ef3281bdcd09e1dabde37334 to your computer and use it in GitHub Desktop.
Forward a remote port to local machine

ssh -L localport:localhost:remoteport username@hostip

e.g. ssh -L 9000:localhost:36839 [email protected]

You can then access the website on your local machine on this url http://localhost:9000

If you need to use a private key file, then do

ssh -i ./path-to-private-key-file -L localport:localhost:remoteport username@hostname

e.g. ssh -i key2.pem -L 9000:localhost:36839 [email protected]

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