Set Up VNC on Ubuntu in Four Steps
Posted by Kevin Purdy at 5:30 AM on November 1, 2007
Linux only: The Ubuntu Unleashed blog has a great tutorial on remote controlling your Linux system—even through a Java-enabled browser. Here's the whole deal:
That third step isn't quite so simple, but luckily we've covered that ground before. The same warnings and disclaimers about running a VNC server in that link above apply here. While the guide and code are written from an Ubuntu users' perspective, the packages and commands, possibly with a little tweaking, should be available in most distributions. Windows and Mac users can get help setting up their own VNC connections through this guide.
- Install packages. Code: sudo apt-get install x11vnc vnc-java
- Set up a password for clients. Code: x11vnc -storepasswd
- Open up ports 5800 and 5900 on your firewall
- Run the terminal command: x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800 and add it for auto-starting in future sessions
Tags: home network | home server | how to | how-to | linux | linux tip | remote desktop | ubuntu | vnc

Comments (AU Comments · US Comments)
There are currently no AU comments for this post.
ClutchDude
Posted 3:56 PM 31/10/07
There is another way, at least in Feisty. Go to Preferences....Remote Desktop. You can then turn on your sharing and security options.
However, you should really do this via an SSH connection. Opening those ports in your firewall makes it an easy scan target for hackers.
ClutchDude
nikoPSK
Posted 7:27 PM 31/10/07
ummm, how do I set up a remote connection in ubuntu 7.10 the option is there but when I try to connect it says there was a timeout...
nikoPSK
leftystrat
Posted 8:57 PM 31/10/07
Will it work? Yes.
Is it secure? Absolutely (Not).
Please think twice before you do this. If it really sounds like a good idea, go online and do a small amount of research on how to use ssh. It's encrypted and much safer. Use complex passwords that are not easily guessable (not your dog, child, birthdate, address, etc). You can forward X through ssh.
There are other ways to do this, but I just figured out ssh for myself.
leftystrat
chacon
Posted 6:31 PM 31/10/07
Actually in 7.04 and 7.10 there is a vnc module for xorg.
Just add
Load "vnc"
in xorg.conf
and run /usr/bin/vncpassword and set a passwd. Restart X and BAM! No need for x11vnc..my old way of doing it.
chacon
chacon
Posted 5:08 PM 31/10/07
There is also a VNC module in xorg. Edit your xorg.conf file like so:
Section "Module"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
Load "vnc"
EndSection
then run /usr/bin/vncpasswd and assign it a password, restart X and away you go.
chacon
Alterne
Posted 5:37 AM 1/11/07
Argh !
3) Open up ports 5800 and 5900 on your firewall
Is this a joke ?
Thant's a "Welcome inside" written on you doormat !
SSH tunneling, please.
Alterne
hometoast
Posted 7:37 AM 1/11/07
I'll reiterate because it needs to be. straight vnc is awfully insecure. Use ssh tunneling and x11 forwarding or use FreeNX
hometoast
chacon
Posted 3:57 PM 1/11/07
i only use it inside my firewall.. no sense in making things harder @ home...
chacon
robertjensen
Posted 2:51 AM 1/11/07
I started to install this but changed my mind. How do you undo everything, especially the open ports, and get back to the original state?
robertjensen
rawfan
Posted 11:18 PM 2/11/07
As others pointed out: DO NOT open the ports in your firewall but rather tunnel them through SSH because VNC is completely non-encrypted (including the password you use to connect)...
Establish the SSH connection like this:
ssh -L 5900:localhost:5900 user@machine
...and connect VNC to localhost. For better speeds you could also try NoMachines NX. It even supports all those nice compiz effects via remote.
rawfan
nstenz
Posted 12:19 PM 4/11/07
Everybody says "set up an SSH tunnel!", but nobody posts any easy instructions to do it. I have plenty of Linux experience, and I couldn't find a single guide online that made it easy (or even difficult). Can somebody at least post a link?
nstenz