Running X11 Applications Remotely
The easiest way to run X11 applications at home, and the method we recommend, is to use SSH forwarding to forward X11 applications to your local X server. To do this, you will need two applications — an X server, and an SSH terminal application.
Windows X11 Servers
- X-Win32 – Most commonly used X server for windows, fairly priced with an educational discount.
- Exceed – Another popular X server, stable, full featured, and equipped with many extra tools.
- Cygwin/XFree86 – Free, though the Windows port of XFree86 is still very much in development, and does not run properly on many configurations. Also required is a decent understanding of UNIX and setting up XFree86. Still, for free you can always give it a try.
- XLive – a free, Cygwin-based X server conventiently packaged onto a CD. It can be installed to the hard drive or run from the CD without requiring installation. This is a good choice for nontechnical users.
Linux/*BSD X11 Servers
- XFree86 – Probably came with your distribution. XFree86 is the most common implementation of X found on Linux and the various BSD distributions. It is fast, stable, and free.
- For OS X version 10.7 (Lion) and older: X11 is included on the os cds Then simply ssh to the host example:
ssh -X email@example.com
- For OS X version 10.8 (Mountain Lion) and up: First you must download and install XQuartz, an Apple supported community X11 server for OS X. Available at http://www.xquartz.org/After you install XQuartz you just need to log out and back in or restart you computer. Then you can SSH with X11 forwarding using the ssh -X flag, for example:
ssh -X firstname.lastname@example.org
Linux, Mac OSX, and other *NIX variations typically come with variations of SSH. If not, you may need to install a version such as OpenSSH.
See our Shell/SSH Access page for more information on SSH clients for other operating systems.
Setting up X11 Forwarding
Many, but not all SSH clients currently available support X11 Forwarding, and general port forwarding. This allows network traffic to be forwarded from the remote machine to your local box through SSH. The result is that with very little configuration, this traffic is forwarded to your machine, encrypted in an SSH “tunnel”.
There are several reasons this is a preferred method to run X11 applications remotely:
- Most importantly, the transmission is secure. Any data, passwords, etc. is encrypted within the SSH tunnel.
- Setup is easy. In most situations, all you need to do is have your X server running. There is no need to modify permissions for foreign hosts, and no need to set your DISPLAY variable. SSH does it all for you.
- With SSH compression turned on, it can actually be faster to use SSH than not on low bandwidth connections.
To set up SSH port forwarding, you simply need to enable that option in your client. We outline a few examples below for common clients:
NOTE: We recommend against using any SSH program that does not support SSH version 2. PuTTY, MacSSH, and OpenSSH support both SSH2 and port forwarding.
- Set up a new session or load an existing one, and set all the appropriate settings you desire.
- Go to Connection -> SSH -> Tunnels.
- Make sure the checkbox “Enable X11 Forwarding” is checked. The box below it should read “localhost:0”. If you are forwarding to your local machine (most likely) this is fine.
- Return to Session, the opening settings window.
- Type in the name of your session, and click “Save”.
- Go to the menu item Favorites -> Edit Favorites.
- Either create a “New” entry, or select an existing one and click “Edit“.
- Enter the hostname and any other desired information.
- Go to the “SSH2” tab.
- Make sure the checkbox “Forward X11” is checked.
- Save your favorite by clicking “OK”.
OpenSSH or the commercial SSH Client
X11 forwarding is typically turned on by default in most *NIX distributions of SSH. If it is not, you can enable it by calling SSH with the “-X” option. For example:
% ssh -X email@example.com
You can also change this option in the SSH configuration files. Please refer to the SSH documentation for more.
NOTE: The -X flag has changed in OpenSSH 3.8 and later, X11 forwarding is performed in a way that applications run as untrusted clients by default. Some applications may not function properly when run as untrusted clients. To forward X11 so that applications are run as trusted clients, invoke ssh with the -Y flag instead of the -X flag, or set ForwardX11Trusted in the ~/.ssh/config file.
Running your Application
This is the best part! First, start your X Server if it isn’t running already. To run the X application you want, simply SSH in to the machine you desire, and run the program. The program should display on your screen, probably after some delay as it loads.
Note that X11 requires a lot of network traffic. Firefox, for example, can take several minutes simply to start and display your home page on slow connections. But some applications are fairly reasonable, especially on a broadband connection such as DSL or Cable. Feel free to experiment with various settings. Many X servers support options that will speed up performance over low bandwidth connections such as caching data, or not refreshing windows that aren’t in focus. Turning on compression in your SSH client can also help in some situations.
If you run into problems, you may need to search the web for other options. If you find something useful, feel free to e-mail us at firstname.lastname@example.org, and we will be glad to add it here.