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 Syncthing installation does not have its port (8384) exposed to computers within the local network. We would be unable to access the web server.
This means that we 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 call
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
127.0.0.1 (Syncthing) from
machine.remote to localhost’s port
12345 (computer with the graphical display)
such that the user on localhost can access machine.remote’s port
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 within the terminal.
Updated 8 January 2018