This page documents how to setup the Xming X Server and PuTTY SSH client so that you can connect to a remote Linux server, run graphical programs (such as XEmacs) and have them display as if they were local windows on a Microsoft Windows computer.

Background

Students usually want the ability to work on programming assignments from a home computer which is often Microsoft Windows. Typically this consists of the student connecting to linux.gl.umbc.edu by using an SSH client (often Tera Term). The most common thing that students wish to do is to be able to bring up a graphical application such as XEmacs. Attempting to do so usually results in frustration. However, achieving this goal is not an impossible task.

This page explains why this is does not work "out-of-the-box". It describes the technologies and problem in attempting to run remote graphical applications. A simple solution to this problem is presented and step-by-step instructions on how to accomplish displaying remote windows are detailed.

The Problem

Usually when you connect via SSH to one of the Linux servers and try to run a graphical application (such as XEmacs) you will get the following error:

Error: Can't open display:

The cause of this error is shown below. Basically when you SSH in and run a graphical application, it has no location in which to draw the window. To put it another way, there is no display associated with that connection. This is analogous to talking to someone over the phone, but the other person has the phone muted — you will never hear what they have to say, because nothing is being sent over the line back to you.

No tunneling without an X server

In order to get the instructions on how to draw the window sent back over the network to our computer the SSH client needs to be configured to request them. This is usually buried somewhere under a menu option such as "X11" or "Tunnels" (if SSHing from a Linux computer use the -X option). However, requesting those connections is simply not enough. If you just request the connections, you will get an error similar to this:

X connection to linux1.gl.umbc.edu:16.0 broken (explicit kill or server shutdown).

The cause of this error is shown below. The problem is that the data is coming across the network to our computer, however there is nothing that is listening for this data. This is analogous to calling someone over the phone, starting a conversation but instead of the other side responding in a language you know they respond in a foreign language.

Tunneling without an X server

To completely solve this problem you will need to both tunnel back the X connection as well as have an X server in place that can make sense of the commands coming across the network as shown below. The role of the X server is to make sense of these commands and translate them into commands that can be drawn by Windows. Going back to the phone conversation, this is analogous to having an interpreter that can interact with you and make sense of what is being said from the other side.

Tunneling with an X server

By taking these two steps...

  • Running an X Server to listen for connections, and
  • Requesting the remote server to forward X connections

...we can successfully locally display graphical applications running on a remote Linux computer. To solve this problem we will use Xming as our X server and configure the SSH client PuTTY to request X connections get tunneled.

About Xming

Xming is an open source light-weight X server for Microsoft Windows. Xming knows how to interpret commands coming back from an X server and draw them under Microsoft Windows.

The official homepage for current Xming development can be found at:

Specifically, the Xming installer can be grabbed from sourceforge:

Installing Xming

Once downloaded, launch the installer and follow these steps to complete the installation.

Initial screen upon launching the installer, click Next The default location is fine, click Next Full installation is fine, click Next Allow the addition to start menu, click Next Check to add shortcuts if you want them, click Next To perform the installation, click Install Go ahead and launch Xming, click Finish

Running Xming

If windows asks, Unblock the application You should notice the Xming icon in the system tray when the application is running

Once Xming is running, your system will be ready to accept connection from remote X servers. Xming will always need to be started before you try to accept X connections. So if you don't see it in the system tray be sure to start it either through the start menu or a shortcut if you created one during the installation process.

About PuTTY

PuTTY is a free telnet and SSH client which can be used to open connections to remote machines. It is very similar to Tera Term (installed in the GL computer labs) however it is still being actively maintained and developed.

The official homepage for PuTTY can be found at:

Specifically, the PuTTY installer can be grabbed from the following page (be sure to get the installer):

Installing PuTTY

Once downloaded, launch the installer and follow these steps to complete the installation.

Initial screen upon launching the installer, click Next The default location is fine, click Next Allow the addition to start menu, click Next Check to add shortcuts if you want them, click Next To perform the installation, click Install To complete the installation, click Finish

Configuring PuTTY

In order to get the remote X server to send X connections back to our X server for display we need to configure PuTTY to forward them. These steps will create and save a session that is configured to connect to linux.gl.umbc.edu and forward X connections back.

The default sessions screen shown when launching PuTTY Expand out and click on Connections → SSH → X11 and check the Enable X11 forwarding checkbox Type linux.gl.umbc.edu into the Host box and give it a name under Saved Sessions Lastly, click Save

In the future you can simply double click the saved session to launch a session with the X connections forwarded.

Running PuTTY

The following shows a typical session utilizing X forwarding. Note that the first screenshot should only appear the first time that you connect to a host (or if the host configuration is changed).

The first time you connect, you will have to add the host to a list of known hosts The normal login process Launching XEmacs in the background (note the &) XEmacs running on the remote server forwarded back and displayed under Microsoft Windows

Conclusion

This technique can be used to tunnel back any X application giving you access to remote graphical applications. However, this technique is not without its drawbacks. This approach is not conservative with respect to bandwidth. A lot of data has pushed over the network in order to draw the windows. This can result in the application reacting slow, especially over slower connections. This is not something that you would want to attempt with anything slower than a broadband connection.

Some alternate approaches include the following:

  • Cygwin provides a UNIX-like environment under Microsoft Windows. You can edit, compile and run applications directly under Windows. Cygwin also comes with an X server that can be used in place of Xming in case you still want to tunnel.
  • XEmacs does have a native Windows version. So it is possible to run XEmacs locally and open a file on a remote server by using a technology such as TRAMP which can utilize SSH to open a remote file or another approach would be to by mount the remote file system using a tool such as Open AFS so it appears as a local drive. One could also transfer the files back and forth with an application such as WinSCP, but that is a bit more tedious.
  • Another approach would be to run Linux locally. You could either install Linux locally (you can install over or along-side of Microsoft Windows) or try booting from a live CD which doesn't touch your hard drive. This would allow you to work locally and scp data to a server when you are done. It could also support X tunneling or SCPing data.