SSH tunnel for OSX screen sharing
June 5, 2013 11:48 AM   Subscribe

I would like to connect to a remote OSX machine for screen sharing via a SSH tunnel. A third machine is acting as the bridge between my local machine and the remote host.

A remote computer named trigger (running OSX 10.5 or 10.6) has an IP address of 123.456.789.101. It can only be connected to from IP address 987.654.321.010 (rothko). I would like to share trigger's screen with my laptop (OSX 10.8.3) at home, through rothko's IP address. I've done this before through SSH tunneling, but always had a helping hand in the past.

I've seen a couple similar questions in ask and the google, but none have helped me out. I have ssh access to rothko (which supports ssh tunneling).

What is the magic command, and /or process to share the screen of trigger through rothko on my local computer?
posted by tip120 to Computers & Internet (5 answers total) 1 user marked this as a favorite
 
On rothko, run ssh -L*:5901:localhost:5900 trigger. The -L flag tells ssh to open a port forwarding connection on the local side., The first argument (*) tells ssh bind to all addresses on the local side, 5901 is the port to listen on, localhost is the host to connect to on the remote side, and 5900 is the port to connect to on the remote host.

On laptop, run open vnc://rothko:5901. This will open the Screen Sharing application, which will try to authenticate you.
posted by mkb at 12:00 PM on June 5, 2013 [1 favorite]


Best answer: sshuttle's a rather nice (easy) solution.
posted by Leon at 12:47 PM on June 5, 2013


You can also use Coccinellida, a little free menubar widget, to configure, start, and stop SSH tunnels. Useful if you're like me and can never remember the magic ssh command-line options needed for various configurations.

I'll note that instead of configuring the tunnel on rothko, you should be able to setup the tunnel on laptop instead: ssh -v -N -L localhost:5000:trigger:5900 rothko. Then connect via VNC to vnc://localhost:5000. This ssh command tells laptop to listen for traffic on laptop's port 5000, send that traffic to rothko, and then for rothko to send it on to trigger port 5900. This way you can easily setup/teardown the tunnel at will from laptop, and only people with access to laptop:5000 (which can be firewalled off) can access the tunnel.
posted by zachlipton at 1:36 PM on June 5, 2013


Response by poster: mkb, when I try ssh -L*:5901:localhost:5900 trigger on rothko, I wind up sshing into trigger and vnc from laptop times out. Any idea what's happening?

zachlipton, vnc times out when I try it that way as well.
posted by tip120 at 5:44 AM on June 9, 2013


Response by poster: Wound up using sshuttle, per Leon's suggestion.
posted by tip120 at 9:46 AM on June 13, 2013


« Older Out of my window, looking in the night: "Barges"...   |   Experiencing sexual dysfunction and other symptoms... Newer »
This thread is closed to new comments.