Wednesday, April 08, 2009

How to VNC from an Android phone to a Linux Computer Securely with an encrypted ssh tunnel.

I know I have not posted anything in forever, but this is just so nerdy I had to post it. I got my full Ubuntu Linux desktop on my T-Mobile G1, and I did it very securely. Here is how you can do it too (provided of course you have an Android powered handset, Linux at home and a desire to show off to nerds everywhere).

To create a secure SSH tunnel to your Linux computer from an android phone;

This guide assumes a few things; that you have an ssh server and VNC server running on your home system, and that you have your home router setup to forward ssh traffic to your home computer. Every router is slightly different so I cannot write a guide for them all, but it should be quite easy to figure out with some basic Google searching. I recommend dyndns to get your routers external facing IP updated through DNS to you can connect with less of a headache when your ISP changes your IP.

1) Download ConnectBot to your phone from the android marketplace, put in your computers IP or hostname information (and password of course). You may want to test this first step to make sure you can ssh in before you set up the port forward.

2) In ConnectBot click menu key on the phone.

3) Click Port Forwards on the screen.

4) Click menu on the phone.

5) Click Add port forward on the screen.

6) Enter the following settings.

Nickname: VNC

Type: Local

Source Port: 5901

Destination: 192.168.X.X:5900 (the Xs of course representing your local IP address on your home system, not the IP address of your Internet facing router. You can find your you IP with the ifconfig command)

7) Download androidVNC to your phone from the android marketplace.

8) Open androidVNC and enter the following settings.

Nickname: (leave this field blank)

Password: (The password you set up on your remote computer for VNC, check the Keep box)

Address: 127.0.0.1

Port: 5901

9) Click connect and you should be connected!