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
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
- 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 .
- Login into the host machine and export the display by running
- 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:
- 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
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.
(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.
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 viaand Mac OS X via .
Additionally, there's a wide range of proprietary X servers available, among the more affordable are:(free of charge, Java) (25$, free for Mac OS) and (100$). ~LinuxWorld has a which might be of interest.
Another (free) possibility is provided by a software called
Currently VNC is not actively maintained, but there's a free (and enhanced) work-alike available, . 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 192.168.0.2:0.
- 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.
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
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 &
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).
: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:
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 ;-).
Revision / Modified: June 18, 2002
Author: Tom Berger
Legal: This page is covered by the. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Version 1.5 last modified by Flink on 23/12/2005 at 18:09