X Networking / Remote Control


  • Exporting the Display to Another Unix Machine
  • Sharing Displays With Machines Running MS Windows Or Mac Os
  • Running Multiple X Sessions
Section index - KB index

X is network-capable. You can run applications on one machine (the application server) and serve them to X servers running on client machines (yes, the server has to run on the client). These clients may run any operating system, as long as there is an X server for this system available. You can also run several instances of X on the same machine.

Exporting the Display to Another Unix Machine

Via xhost

  • The client has to run an X server.
  • To allow the client to receive X data from the host (the application server), type xhost +name_or_IP_of_host
    If you can connect to the remote via SSH, you can run X applications very easily - and more secure - via an SSH tunnel.
  • Login into the host machine and export the display by running
export DISPLAY=name_or_IP_of_client:0
  • Start a program of your choice on the host from the client machine.


XDMCP is the X Display Manager Control Protocol. In order to use it, you will have to log in via a graphical login manager (GDM, KDM) on the machine which will act as the server. Configuration steps require 'root' privileges and have to be done on the machine running the login manager only.

  • Edit '/etc/X11/xdm/xdm-config' and put an exclamation mark in front of this line:
~DisplayManager.requestPort:     0
  • Edit '/etc/X11/xdm/Xaccess' and remove the hash (#) in front of this line (if there is one):
*     # any host can get a login window
  • Edit '/usr/share/config/kdm/kdmrc' and change
&#123;Xdmcp&#125;<br> Enable=false


&#123;Xdmcp&#125;<br> Enable=true

If you're using GDM, you can configure that in the advanced options field of gdm-config.

  • Log out of your X session and log in again.
Now go to the client machine, log into a console and run

X -broadcast

(notice that you can and should do this as non-root). The login screen of the remote machine running the display manager will come up and you can log in.
All applications will run on the remote machine and the visuals will appear on the local machine via the network. To quit the session, log out and choose 'Close Connection' from the 'Menu' dropdown.

Since the local X server requires very little resources, this is a neat way to run a full blown graphical desktop on older machines.

Security notice: Only use XDMCP in trusted environments, there's no encryption whatsoever, everything - including passwords - is sent in plain text over the network between the connected machines. XDMCP requires UDP port 177 to be open on the display server.

section index

Sharing Displays With Machines Running MS Windows Or Mac OS

In order to import an X display from another machine, the importing machine has to run an X server. Currently XFree is available for all major operating system including MS Windows 9x / NT /XP via cygwin and Mac OS X via ~XonX.

Additionally, there's a wide range of proprietary X servers available, among the more affordable are: ~WiredX(-Lite) (free of charge, Java) MI/X (25$, free for Mac OS) and X-~WinPro (100$). ~LinuxWorld has a comparative review of three proprietary X servers which might be of interest.

Another (free) possibility is provided by a software called Virtual Network Computing. VNC allows you to access displays of Unix, Windows and Mac machines from other Unix, Windows or Mac machines. In contrast to X servers, VNC will always serve the complete remote desktop and not single applications.
Currently VNC is not actively maintained, but there's a free (and enhanced) work-alike available, ~TightVNC. Their Red Hat 7.x RPMs should work on Mandrake Linux 8.x systems. You might prefer them to the old VNC RPMs which come with Mandrake Linux. The rest of this article refers to this version of VNC.

Notice that you might void your Windows XP license by running a VNC server on XP:

>"Except as otherwise permitted by the ~NetMeeting, Remote Assistance, and Remote Desktop features described below, you may not use the Product to permit any Device to use, access, display or run other executable software residing on the Workstation Computer, nor may you permit any Device to use, access, display, or run the Product or Product's user interface, unless the Device has a separate license for the Product."
(from: Microsoft Windows XP Pro EULA)

Setting up VNC is a snap:

  • Start the VNC server on the machine whose display you to export and provide a password for the client.
  • Start the 'vncviewer' on the machine you want to import the display to providing the IP of the machine which runs the VNC server and its display number (Windows and Macs only have one display, it's '0'), like this vncviewer
  • You will be prompted for a password.
  • Another window will pop up on the client machine, containing the desktop of the machine running the VNC server.
  • Now you can move around, run programs or even shut down the remote machine.
Keep in mind that data is transfered unencrypted. So it might be a good idea to run VNC through an SSH tunnel.

On my former 10MBit LAN the speed was bearable enough to run applications like Word or the Internet Explorer (not at the same time, though). Of course, the real fun starts at 100MBit ;-). The load on the client machine is next to none, in fact, when I wrote the original version of this article, I had it running along with 3 virtual terminals and Netscape Communicator. On KDE. And 64MB RAM ;-).
Cut and paste between client and server works for unformatted ASCII text, but you don't need it anyway: just start a FTP client/server pair on both machines and transfer the files (or use scp/sftp when you're tunneling). Neat, really.

One minor drawback on Linux is that you can't export the current display in use, VNC will always start the server at the next available display number.
By editing '~/.vnc/xsetup' you can set the window manager which is to run on the exported display. Otherwise the 'twm' manager would be started and you really don't want this, believe me ;-). Add a line like

exec wmaker &
and everything should be fine (you might want to make sure that the Window Maker package is installed).

section index

Running Multiple X Sessions

Yep, even this is possible (whether it is sensible is another question ;-)). In fact it is what VNC basically does. It goes like this:

  • Start your X server like you always do.
  • Now switch to the second console by pressing .
  • Login and start the next X server by startx –– :1
  • You can now switch X sessions with (first session) and (second session).
  • This way you can start up to six different X servers (i.e. one on each virtual console).
If you want to start several X servers by default, you can do that, too. Make a backup of '/etc/X11/xdm/Xservers' and then edit it as 'root':

:0 local /usr/X11R6/bin/X -bpp 16 vt7 :0<br> :1 local /usr/X11R6/bin/X -bpp 24 vt8 :1<br> :2 local /usr/X11R6/bin/X -bpp 8 vt9 :2

This will start three X servers, the first on virtual terminal 7 with a color depth of 16 bpp, the second on virtual terminal 8 with a color depth of 24 bpp and a third on virtual terminal 9 with a color depth of 8 bpp. Supplying the color depth option is - well - optional.

What now happens is this: you get into the KDM login screen and login as usual. You are on the default X server, display :0, virtual terminal 7. Now press . You are now on the second X server, display :1, virtual terminal 8 and are greeted by the KDM login screen again. Press and - well, you get the idea. By pressing you can instantly switch between these sessions.

Another option is running another X session inside your current session. This can be done using 'Xnest' (package XFree86-Xnest), a virtual X server. Start it with:

Xnest :1 -ac &

and you should get a 'gray' X window (notice that the '-ac' option turns off access control, it's convenient but might be dangerous in an untrusted network). Somewhat boring, though. Obviously you can get things started only from your current session. Open a new command line window and type:

export DISPLAY=localhost:1

Now every application you start from this command line window will run on the virtual X server. Start an terminal like 'xterm' or 'rxvt' from the command line and you'll see the application appearing in the Xnest window. How about a window manager? Sure thing, why not:


will start the 'Window Maker' window manager in Xnest (provided it is installed). One word of caution though: do not run the same window manager or environment in Xnest you are using on the 'real' X session. This will at least crash the server.

You see what amazing possibilities X offers you. Go wild1.1 But read the available documentation first ;-).

section index

Related Resources:

man xhost
Remote X Apps mini-HOWTO
VNC documentation
man Xserver
man Xnest

Revision / Modified: June 18, 2002
Author: Tom Berger

Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.

KB - X Networking / Remote Control
Version 1.5 last modified by Flink on 23/12/2005 at 18:09


en fr


Creator: AdminWiki on 2004/03/22 09:45
(c) Mandriva 2007