Skip to Content

Broadcasting a VNC server to Mac OS X Leopard from Ubuntu

I'm going to cover how I very simply got a vanilla Ubuntu install to broadcast a VNC server to my Macbook. Why would I do this? Well, I have an extra computer hanging around and I wanted to use it to remotely download torrents. This way it won't get in my way while I'm working and I can manage torrents while I'm away from home.

So here's how I did it!

I installed Ubuntu 7.10 using all the default settings and opened up Multiverse and Universe repositories. This might not be necessary, but you will probably want to do it eventually.

After that I opened a terminal window (Applications > Accessories > Terminal) and installed and configured x11vnc using the following commands:

$ sudo apt-get install x11vnc
$ x11vnc -storepasswd

Then I added x11vnc to start with my Ubuntu session. To do this I added the following to System > Preferences > Sesssions:

Adding VNC in my Ubuntu session: Here is the Sessions window in Ubuntu

The command 'x11vnc -forever -usepw -avahi' does the following:

  • forever makes the session stick after logging out
  • usepw lets you use the password created earlier by 'x11vnc -storepasswd'
  • avahi is for magically broadcasting the VNC server for discovery by OS X

We're done configuring Ubuntu, so restart your X11 session or logout and login again.

Now for the fun part!

Open up Finder in Mac OS X Leopard and you should see computername:0 under shared in the window. Click on the computer and you'll see a nice little button to 'Share Screen...'. You will probably get a warning about keystrokes not being encrypted which you can ignore.

The Finder window with a shared screen visible

Leopard has a hidden application called Screen Sharing which works really great. If you want to put the Screen Sharing application on your dock, you can find it in /System/Library/CoreServices/Screen Sharing. The application is intended for easy sharing of Mac screens but it works great for Linux as well. Instead of using the built in screen sharing with Leopard, another great VNC application is Chicken of the VNC. Despite its sketchy name it works really well.

Other tips:

  • If you want to access the server remotely you will need to forward port 5900 to you Ubuntu box. I also configured a dynamic DNS with my router and I can easily login from anywhere
  • If you want to speed up VNC, change your colour depth to 16bit and lower the screen size
  • Install a better bittorrent client. The default Ubuntu client is really barebones and I would recommend using either Azureus or Transmission (both of these clients are also available for OS X)

And that's it! Another thing that you might also want to install is SMB or AFP file sharing in Ubuntu, this way you can get your files off of the box.

Here are some resources I used:
http://lifehacker.com/software/how-to/set-up-vnc-on-ubuntu-in-four-steps...
http://www.sanityinc.com/articles/mac-screen-sharing-with-linux

Sweet, thanks, this has been

Sweet, thanks, this has been on the todo list to set up.

Cool cool, let me know how

Cool cool, let me know how it goes :)

Huge thanks, but I'm going

Huge thanks, but I'm going to add the following line to your comment so I can find this page again using google, since the only thing I remember is that I added it to a session and you used an image to show the words:

x11vnc - forever -usepw -avahi

Now the final thing, how do you get rid of the :0 so the mac would show the screen share + the disks under one icon like for normal mac boxes?

Back again and I found out

Back again and I found out how to broadcast it so that you just get one icon for your server showing disk + screen sharing:
http://www.sanityinc.com/articles/mac-screen-sharing-with-linux

I had to change one thing from his site, he was using port 5901 for his type of vnc server but we need 5900, the instructions below include the change:

You need to create the file /etc/avahi/services/rfb.service and add the lines below to it and then restart avahi with the magic incantation sudo /etc/init.d/avahi-daemon restart

<?xml version="1.0" standalone='no'?>

%h

_rfb._tcp
5900

Arrghh, the code contains

Arrghh, the code contains xml so it gets screwed up, even using code tags when posting it doesn't work. Your best bet is to take the code from the site I linked to, but remember to change the port from 5901 to 5900 or whatever you're using for the vnc server.

Last one and I promise not

Last one and I promise not to hog the comments any more. This is a great post about how to set up your ubuntu box to use afp + use it as a time machine backup server + change the icon displayed for your server:
http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-m...

Thanks for all of the info

Thanks for all of the info TC, I haven't taken a look at this in a while now but I like the idea of using an Ubuntu box for Time Machine. Cheers!

Hi Tylor I was deligthed to

Hi Tylor

I was deligthed to find this tutorial but have tripped up at the start! I have a clean install of Ubuntu 8.10; when I try "x11vnc -storepasswd" and enter a password, then verify the password it tells me that the passwords differ, even though they definitely do not (I tried it a million times to be sure).

Any ideas?

Hi Headly, hope you managed

Hi Headly, hope you managed to figure out what was wrong because I can't really think of any reason that would fail.