you ever wanted to run a graphical application securely and
remotely with Linux or Unix? How about from a Microsoft Windows
PC to a Linux/UNIX host? This tutorial is about X,
SSH2, and window managers. This is not about VNC,
a completely different tool which merits its own tutorial. It is not
about thin-client computing using X, another huge topic. The
focus of this article is on how you, as a system administrator or power
user, can use X over SSH to get work done. As a special bonus, most
GNU/Linux distributions already contain everything you need,
so you will probably not need to install anything or modify any configuration
files in order to use these tools.
What is the X Window System ?It is a system that allows graphical applications to be used on Unix-like operating systems instead of text-only applications. It is the foundation for Linux and Unix GUIs (Graphical User Interfaces). X development began at MIT in 1984, with assistance from IBM and DEC (later Sun, HP, Apollo, and Tektronix). It has the following features:
- network aware
- hardware independent
- vendor independent
- allows interoperability between heterogeneous systems
X (current version, X11) is defined by standards and contains standardized protocols. The X server is a process that runs on a computer with a bitmapped display, a keyboard, and a mouse. X clients are programs that send commands to open windows and draw in those windows. Although the client and server are typically on the same machine, they can also run on different machines over a TCP/IP network. X typically uses TCP ports 6000 - 6063.
For example, I frequently run X over my private LAN from a laptop to my server. I also routinely use X over SSH to run GUI apps back in the United States while I am in Taiwan! The "networkability" of X allows a powerful central server to run graphical applications or even entire GUI desktops for hundreds of less powerful machines, such as X terminals or thin-clients. It is also quite common to run X servers on MS Windows PCs in order to access graphical applications on more powerful Unix or Linux machines.
There are some problems with classic X networking, though. It can be a difficult to setup, has security issues, and may not work well over low-bandwidth WAN links. It can also be broken by firewalling and NAT. These issues typically restrict classic X networking to private LANs.
The X11R6-compliant X software I will be talking about in this tutorial is XFree86, an Open Source implementation that is usually seen on Linux and the various BSDs. I have also been able to run X client/server sessions between Solaris and Solaris, and Linux and Solaris, even though Solaris 8 does not use XFree86.
For more information on X, you may want to go right to the official website: www.x.org
What is SSH ?SSH, or the Secure Shell is the "Swiss Army knife" of host-to-host networking. It allows secure (encrypted and authenticated) connections between any two devices running SSH. These connections may include terminal (CLI) sessions, file transfers, TCP port forwarding, or X Window System forwarding. SSH supports a wide variety of encryption algorithms, including AES-256 and 3DES. It supports various MAC algorithms, and it can use public-key cryptography for authentication or the traditional username/password. The good news is that SSH does not cost anything on the client or server side, although there are some nice SSH packages for MS Windows that require you to purchase commercial licenses.
X over SSH solves some of the problems inherent to classic X networking. For example, SSH can tunnel X11 traffic through firewalls and NAT, and the X configuration for the session is taken care of automatically. It will also handle compression for low-bandwidth links.
For more info on SSH, check out the official OpenSSH website .
What is a Window Manager ?A Window Manager is a piece of software that manages windows, allowing the windows to be opened, closed, re-sized, and moved. It is also capable of presenting menus and options to the user. It controls the look and feel of the user's GUI. With Linux or BSD, you have choices. You are free to select any number of window managers, ranging from lean-and-mean simple ones (low memory and CPU consumption), to feature-packed large ones. There are approximately 17 "mainstream" window managers, and at least 70 others.
Here is a short list of some of the more popular ones: fvwm2, twm, mwm, wm2, AfterStep, Enlightenment, WindowMaker, IceWM, Sawfish, Blackbox, Fluxbox, and MetaCity. For a really nice website that lists them all, try www.plig.org/xwinman/ .
What is a Desktop Environment ?A desktop environment (DE) usually rides on top of a Window Manager and adds many features, including panels, status bars, drag-and-drop capabilities, and a suite of integrated applications and tools. In fact, user opinions on operating systems are typically based on one thing: the Desktop Environment. Of course, the DE is only a small part of an OS, and in Linux and Unix systems, the Window Manager and/or DE can be replaced or highly customized without violating any end-user licensing agreements.
The most popular Desktop Environments for Unix/Linux are: GNOME, KDE, CDE, and XFce. Of couse, there are others.
1. X over SSH on a LAN
2. X over SSH on a long-distance WAN
3. Desktop Environment over SSH
4. X over SSH from a Win32 PC to a Linux host
Note: I was able to use FreeBSD
on RAT's hardware to test some of the X over SSH scenarios. LAPTOP
to BSD-RAT worked fine.
|Window Manager /
||# of X Windows open
||% memory used by
||Total Number of GUI-related
||Notes and comments
||Fast. Exits cleanly.
||< 2 %
||Fast. Exits cleanly. Less intuitive
||< 2 %
||Longer load time compared with mwm
and twm. Exits cleanly.
||< 2 %
||Relatively fast, looks nice, very
customizable. Exits cleanly.
||< 3 %
||Comes up slowly. Exits cleanly.
Fairly responsive on LAN, complete DE.
||< 3 %
||Comes up slowly. DOES NOT EXIT
cleanly (left 2 windows and 4 processes open that had to be killed
manually). Fairly responsive on LAN. Looks nice, complete
||< 2 %
||Slower to load than mwm or twm, but
faster than the others. Fast, responsive, uncluttered. Customizable.
|X Client (Program)
||Avg. BW Util.
|Packets Per Sec.
|Avg. Packet Size
||Comments and Notes
|xdaliclock -cycle (1)
|xdaliclock w/SSH compression (2)
||Used the -C option in the SSH command
|mwm window reposition (3)
||Constant window movement. See
|mwm window repos. w/compression
||Constant window movement w/SSH compress.
|xclock -update 1 (large) (4)
||Resized to 1/4 of screen
|xclock (large) w/compression (5)
||Same as above, with -C option in SSH
|kasteroids arcade game (6)
||Game was fairly responsive
|kasteroids game with compression
||Game was fairly responsive
|KDE session startup (7)
||Opened 12 windows
|KDE session startup w/compression (8)
||Opened 12 windows, took longer to load
|KDE session w/lots of activity (9)
||Desktop was responsive. See note.
|KDE session w/compression
||Desktop was responsive
|Creating a text file in Pico in an xterm
||Typical text editor session
|Abiword word processor (11)
||Worked fine. See note.
|Mozilla browser window scrolling
||Constant scrolling of web page up &
|Mozilla window scrolling w/compression
||Save as above, with -C option in SSH