How to Connect to a Local Port on a Remote SSH Server



If you ever have a web server (or other type of server) running on a remote Linux box, and you want to connect to it using your local system, here’s how you do it.



ssh -i ./.ssh/key.pem -N -L 8081:localhost:8000 user@host



This reads as:




Authenticate using a key.
The port you’re listening on on your local system is localhost:8081.
The port you’re listening on on your remote Linux box is localhost:8000.
You’re connecting as user@host.


Then you just go to your browser and browse to: localhost:8081, and you’ll be touching the local port 8000 on the remote box.





Hope it helps someone.


__


I do a weekly show called Unsupervised Learning, where I curate the most interesting stories in infosec, technology, and humans, and talk about why they matter. You can subscribe here.

 •  0 comments  •  flag
Share on Twitter
Published on April 13, 2017 17:55
No comments have been added yet.


Daniel Miessler's Blog

Daniel Miessler
Daniel Miessler isn't a Goodreads Author (yet), but they do have a blog, so here are some recent posts imported from their feed.
Follow Daniel Miessler's blog with rss.