I’ve been using SSH to play with my home Mac for a while, but now figured out how to get VNC working through the VNC access.
For clarity, the home Mac is called Coruscant.
I had to set up screen sharing on Coruscant locally. I tried to enable it throught the command line SSH access, but didn’t get very far. Locally, you use the Sharing Preference pane. (I think) It’s important to enable the VNC password for non-mac systems to be able to connect.
Now, I left home and went to visit family. The first step to connect is to open a tunnel from a port on the local machine, through SSH to port 5900 on Coruscant.
The following command does it.
ssh -C -L 59001:127.0.0.1:5900 user@coruscant external ip
-C enable compression, which can help performance over the slow Internet.
-L 59001:127.0.0.1:5900 configures the tunnel – 59001:127.0.0.1 is the local port and address to connect with. 5900 is the port on Coruscant to connect with.
user@coruscant external ip is the normal SSH connect to use. I have dyndns set up so I use that address to resolve to the external IP address of Coruscant.
Next, just go to vnc://127.0.0.1:59001 in safari, and screen sharing opens and connects (after prompting for authentication)
It’s pretty much the same to connect from a non-mac system (at least the numbers are)
Links
Why not just go to vnc://ip-to-home:5900 ?
Then you’d have to open and forward another port on the router. Also, SSH is more secure than just using VNC.
Tunnels are fantastic for connecting to pretty much anything on your home network when remote, such as the router’s admin webserver or other computers on SSH or HTTP, without exposing them directly on the external network.