Monthly Archives: June 2017

Using SSH to connect a computer on your remote network

So let’s say you expose SSH of your Raspberry Pi to the internet and you’d like to be able to VNC or RDC to a Windows machine on the same network while you’re away.

What you need to do is use SSH to forward your computer’s local port to the port of the remote network computer

Here’s an example:
ssh -L 5900:10.0.1.50:5900 ethanms@ethanms.com

The command above will connect me via SSH to my machine exposed at ethanms.com and use it to forward any requests to my own localhost port 5900 to port 5900 at the remote network address 10.0.1.50.

Assuming that address has a VNC server running I can open VNC viewer on my local machine and try to connect to localhost:5900–it’ll connect me to that remote machine.

This is super useful and doesn’t require you to go through complicated VPN setup, expose a ton of ports to the internet, or use a service that tunnels out and exposes your computer (like Team Viewer or Log Me In)