Linux (Ubuntu) + OSX

Ubuntu on OSX

At home I have a Macbook Pro that acts as my everyday desktop computer and a headless (no monitor) Ubuntu Linux server that acts as a development testbed. The Ubuntu server has Apache, MySQL and PHP installed for development. My Mac has that too, but I prefer turning those services off and let the Linux machine do the heavy lifting. Usually, it’s sufficient to log into the Linux machine through SSH and hack around with vi. However, there are times that you may want to log into the Linux GUI. That’s a pain in the arse for me, since I would have to connect a monitor and keyboard to the server. The simplest solution is to log in through X and XDMCP.

Things you’ll need:

Linux Server (Ubuntu for simplicity)

X11 for OSX

Step 1:

Ensure GDM is running on Ubuntu. If you installed the basic Ubuntu Desktop (and not Kubuntu) it probably is.

Step 2:

On the Ubuntu machine.

Edit /etc/gdm/gdm.conf

search for:

DisallowTCP=true

And change it to false

look for:

[xdmcp]

Enable=false

Change it to:

Enable=true

Note: doing this will open port 117 (XDMCP) to the world. Ensure you are behind a firewall so that your Ubuntu machine isn’t open. It’s beyond the scope of this post, but it’s critical that the port is protected.

Step 3:

Restart GDM

sudo /etc/init.d/gdm restart

On the Mac OSX side.

Ensure X11-Quartz is installed (the top link has directions on how to do that).

Step 4:

Allow the Ubuntu machine to connect to OS X. Open up Terminal and type in:

xhost +<ip of linux>

eg. xhost +192.168.1.111

Step 5:

Connect with this command:

/usr/X11R6/bin/X -query <ip of linux>

ie.

/usr/X11R6/bin/X -query 192.168.1.111

If all goes according to plan, you should be seeing a login screen. Type in your username and password, and you’ll have Linux running on your Mac via X11 (see screenshot above).

Comments are closed.