1.20. Remote Graphics

Most users will not need to run graphical applications on a remote Unix system.. If you know that you will need to use a graphical user interface with your research software, or if you want to use a graphical editor such as gedit or emacs on over the network, read on. Otherwise, you can skip this section for now.

Unix uses a networked graphics interface called the X Window system. It is also sometimes called simply X11 for short. ( X11 is the latest major version of the system. ) X11 allows programs running on a Unix system to display graphics on the local screen or the screen of another Unix system on the network. The programs are called clients, and they display graphical output by sending commands to the X11 server on the machine where the output is to be displayed. Hence, your local computer must be running an X11 server in order to display Unix graphics, regardless of whether the client programs are running on your machine or another.

Some versions of OS X had the Unix X11 API included, while others need it installed separately. At the time of this writing, X11 on the latest OS X is provided by the XQuartz project, described at https://support.apple.com/en-us/HT201341. You will need to download and install this free package to enable X11 on your Mac.

1.20.1. Configuration Steps Common to all Operating Systems

Modern Unix systems such as BSD, Linux, and Mac OS X have most of the necessary tools and configuration in place for running remote graphical applications.

However, some additional steps may be necessary on your computer to allow remote systems to access your display. This applies to all computers running an X11 server, regardless of operating system. Some additional steps that may be necessary for Cygwin systems are discussed in Section 1.20.2, “Graphical Programs on Windows with Cygwin”.

If you want to run graphical applications on a remote computer over an ssh connection, you will need for forward your local display to the remote system. This can be done for a single ssh session by providing the -X flag:

shell-prompt: ssh -X joe@login.peregrine.hpc.uwm.edu

This causes the ssh command to inform the remote system that X11 graphical output should be sent to your local display through the ssh connection. ( This is called SSH tunneling. )


Allowing remote systems to display graphics on your computer can pose a security risk. For example, a remote user may be able to display a false login window on your computer in order to collect login and password information.

If you want to forward X11 connections to all remote hosts for all users on the local system, you can enable X11 forwarding in your ssh_config file (usually found in /etc or /etc/ssh) by adding the following line:

	    ForwardX11 yes


Do this only if you are prepared to trust all users of your local system as well as all remote systems to which they might connect.

Some X11 programs require additional protocol features that can pose more security risks to the client system. If you get an error message containing "Invalid MIT-MAGIC-COOKIE" when trying to run a graphical application over an ssh connection, try using the -Y flag with ssh to open a trusted connection.

shell-prompt: ssh -Y joe@login.peregrine.hpc.uwm.edu

You can establish trusted connections to all hosts by adding the following to your ssh_config file:

	    ForwardX11Trusted yes


This is generally considered a bad idea, since it states that every host connected to from this computer to should be trusted completely. Since you don't know in advance what hosts people will connect to in the future, this is a huge leap of faith.

If you are using ssh over a slow connection, such as home DSL/cable, and plan to use X11 programs, it can be very helpful to enable compression, which is enabled by the -C flag. Packets are then compressed before being sent over the wire and decompressed on the receiving end. This adds more CPU load on both ends, but reduces the amount of data flowing over the network and may significantly improve the responsiveness of a graphical user interface. Run man ssh for details.

shell-prompt: ssh -YC joe@login.peregrine.hpc.uwm.edu

1.20.2. Graphical Programs on Windows with Cygwin

It is possible for Unix graphical applications on the remote Unix machine to display on a Windows machine, but this will require installing additional Cygwin packages and performing a few configuration steps on your computer in addition to those discussed in Section 1.20.1, “Configuration Steps Common to all Operating Systems”.


You will need to install the x11/xinit and x11/xhost packages using the Cygwin setup utility. This will install an X11 server on your Windows machine.


After installing the Cygwin X packages, there are additional configuration steps:

  1. Create a working ssh_config file by running the following command from a Cygwin shell window:
    shell-prompt: cp /etc/defaults/etc/ssh_config /etc
  2. Then, using your favorite text editor, update the new /etc/ssh_config as described in Section 1.20.1, “Configuration Steps Common to all Operating Systems”.
  3. Add the following line to .bashrc or .bash_profile (in your home directory):

    		export DISPLAY=":0.0"

    Cygwin uses bash for all users by default. If you are using a different shell, then edit the appropriate start up script instead of .bashrc or .bash_profile.

    This is not necessary when running commands from an xterm window (which is launched from Cygwin-X), but is necessary if you want to launch X11 applications from a Cygwin bash terminal which is part of the base Cygwin installation, and not X11-aware.


To enable X11 applications to display on your Windows machine, you need to to start the X11 server on Windows by clicking Start All Programs Cygwin-X XWin Server. The X server icon will appear in your Windows system tray to indicate that X11 is running. You can launch an xterm terminal emulator from the system tray icon, or use the Cygwin bash terminal, assuming that you have set your DISPLAY variable.