VNC (Remote Access) in Ubuntu 11.10 – 100% working

So you want to remotely access your Ubuntu machine, a couple of easy steps will do the trick for you:

  1. Install packages. Code: sudo apt-get install x11vnc vnc-java
  2. Set up a password for clients. Code: x11vnc -storepasswd
  3. Open up ports 5800 and 5900 on your router (Should be under firewall rules, or virtual server or NAT)
  4. Run the terminal command: x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800 and add it for auto-starting in future sessions

These instructions are thanks to Lifehacker

Please note that in order to connect to your machine you need to run step 4 each time, unless you have configured it to run upon startup. The way I do it, is to login to my machine via ssh, and then I run step 4. I am then able to connect to my Ubuntu machine using either UltraVNC, or TightVNC. While im at it, its very simple to install ssh in ubuntu, simply execute the following command:

sudo apt-get install openssh-server

And this way you’re able to login to your terminal from anywhere, provided that you have also forwarded port 22 from your router to your Ubuntu machine.