![]() |
BX Land
Home to all things Bruce Grant
|
|
![]() |
Author: Bruce Grant, Jr. (BX)
Published: May 7, 2008
Forwarding a Remote Port to a Local Port using SSH
This article provides a simple example of using SSH to forward web content from a port on a remote server to a port on a local computer and view the content in the local web browser. It's not meant to be a comprehensive guide on ssh or port forwarding. Instead, it's meant for the relative Linux novice who needs to figure out how to do simple port forwarding. A basic knowledge of using ssh to log into a server is required.
I constantly forget how to forward a remote port to a local port using ssh so I'm going to blog it here so I won't forget it anymore. This is not meant to be a definitive guide on ssh. For that jump over to the ssh man page or this tutorial.
I have an administrative console on a specific port serving up http on my home server. I don't allow that port out of my firewall for obvious security reasons. Occasionally, however, I'd like to access that web console when I'm not inside my home network. There's a simple solution: SSH port forwarding. My remote server is "www.myserver.com". My web console on www.myserver.com is running on port "8999". The user name I'm going to use to log into the remote server is "myusername". I want to type "http://localhost:8080" in my web browser and see the web console forwarded over SSH and appear on my local machine. So run the command below and then go to your browser using the localhost url and it should work. Port Forwarding Lets say you're running SSH on a custom port, say 8111, instead of the default port 22. In that case, here's the command: Port Forwarding with Custom SSH Port Comments
Be the first to add a comment.
Add a Comment
|
|























