SSH Port Fowarding Tunnels
The other day I needed to set up a Syncthing instance on a remotely networked server that had no graphical display. I didn’t want to set it up using the command line tools and I definitely did not want to install a graphical environment on the server to access the web GUI.
There is another computer with a graphical display on the local network. The only problem is that a standard
does not have its port (
8384) exposed to computers on the local network. We would be unable to access the web server.
This means that one would need to expose that port either by configuring
syncthing directly or by opening up the respective port. That direction is more involved. There is a great solution to this problem and it’s called
SSH port forwarding. The solution comes down to this single command.
ssh -v -NL 12345:127.0.0.1:8384 machine.remote
The above command states that it will forward or bind port
12345 (computer with the graphical display)
such that the user on
localhost can access
8384 as if it was on port
-N flag prevents the
SSH command from executing on the remote so that it is forced to run as a foreground process at the command line.
8 January 2018