Bob's Notepad

Notes on projects I have done and things I have learned saved for my reference and for the world to share

Tuesday, November 28, 2006

VNC and SSH Tunnel on OSX (and other unix)

The problem was that I could not access my parents computer because for whatever reason, their router refused to forward a connection for port 5900 (VNC). I was, however, able to SSH to the linux server in their basement and doing a "telnet ip.address 5900" showed that their VNC client was responding fine. Of course it's always better to use SSH for VNC anyway so I figured this was a good time to learn how. On my iBook it was a very simple command in the terminal window and this should be the same for any version of UNIX/Linux as well. The solution is the -L option for SSH.

Here was the command that I issued:

ssh -L 5900:192.168.1.75:5900 admin@parents.house.net -p 222

The 192.168.1.75 address represents what my parents computer's IP address is on THEIR local LAN. The first 5900 represents the port that my local computer will respond on and the second 5900 is the port that the linux server at their house will forward traffic to. The parents.house.net address is the (fictional) dynamic host name they are using and the 222 is the port that the linux server is responding to ssh requests on.

Once you issue that command, it asks for admin's password and then takes you to a shell on the linux server.... the difference is that now your computer is responding to 5900 locally and sending all the data directly to 192.168.1.75:5900 on their local LAN.

Just open up Chicken of the VNC or other favorite VNC client and connect to "localhost:5900" and all your traffic is headed directly through the SSH tunnel.
Reference Link


3 Comments:

Anonymous spino said...

yout parents have a linux server in their basement? that's cool!

23/2/08 8:37 PM  
Blogger devros said...

Should also be noted that this is now built right into Jolly's Fast VNC.

Put the server's address that you will be setting up the ssh tunnel with and the local port #(5601 in my case) and xxx is the local IP of the server you want to establish the VNC connection to. In my case, I'm running ssh on port 69

Just choose the SSH option for Security Type and put in the string -L 5901:xxx.xxx.xxx.xxx:5900 -l user -p 69

28/7/09 4:19 PM  
Blogger Matt Zukowski said...

This was really helpful. Thanks!

19/5/10 1:49 PM  

Post a Comment

Links to this post:

Create a Link

<< Home