Mac OS X networking with remote X Windows host

 

Introduction

Scenario: you have two machines, (a) Mac running OS X. (b) UNIX, Linux etc machine. But you have only one monitor (or) you would like to access both machines from one terminal.

By following the instructions on this page you will be able to remotely connect to your Linux machine from your mac (yes, I mean run graphical applications too. This is know as an X Terminal). If you didn't know, your OS X mac is actually running a variant of Unix, known as Darwin. This is as capable as any other unix box, ie you can add, modify and configure it do what ever the hell you like.

 

Terminonogy

Unix is an operating system accessed via the command line. A graphical interface can sit on top, called X Windows. You run the X Server on the machine you sit at and the computer you want to access (called the X host) connects to your X server and displays the info on your screen.

This one-off displaying of a remote machine on your machine in X windows is called an X session. The look and feel of an x session is controlled by the window manager. These can look however you like and can be as heavy, feature rich, or lighweight as you like. If you have a 1GHz machine you will probably want KDE (looks good, full of MS friendly features and wizards) but if you've got an old Pentium 150MHz machine you'll be better of with something like MWM, twm (classic unix looks) or Windowmaker or Blackbox (newer funky).

 

Configuration

You must be able to connect to your different machines by hostnames rather than IP addresses for the X server to be happy (ie ssh mypc instead of ssh 10.0.0.1)

(1) Create the following directory if it doesn't already exist.

/etc/lookupd

(2) type (as root)

echo LookupOrder CacheAgent FFAgent NIAgent DNSAgent YPAgent NILAgent > hosts

(this is an easy way of puitting the text after the word "echo" into the file "hosts"

(3) Now you need to edit the file /etc/hosts. Do this by invoking your favourite editor, eg

pico /etc/hosts

and add the lines (edit to suit yourself)

10.0.0.1 mymac.local mymac

10.0.0.2 mypc.local mypc

Note: you can also add the names of adservers to this file in order to stop adverts appearing when you browse, eg 127.0.0.1 ads.adserver.net

Now you should be able to connect between your machines without typing IP addresses. Test it by pinging your computers.

(4) Now in order to allow the x session (you can't have anyone displaying stuff on your machine), on your linux box configure your Xaccess file. I've forgotten how but will put it up when I have time.

(5) To get your session, from your mac (you must have XDarwin installed, this comes with OpenOffice. Do not run XDarwin, simply be in the root directory for it (/usr/X11/bin) or have the latter included in your path) and enter

X -query mypc