Using X Forwarding on Windows


By Evan Murphy, 4/17/2006. Revised by Mike Vanier, 4/24/2006.

Introduction

Most CS 11 students do their labs from the comfort and convenience of their own rooms. However, since most people are stuck running Windows, and the CS cluster machines run Linux, there's a problem. If you did your labs on the CS cluster computer, you would get a nice graphical interface to work with. But if you log in remotely to the CS cluster with (say) PuTTY, then all you get is a single terminal. Worse, you can't start up graphical programs, because the graphical interface software on Linux is different from that on Windows.

That being the case, you have these choices:

  1. You can come in to the CS computer lab to do your assignments
  2. You can grin and bear it, and work within one lousy terminal and a non-graphical editor.
  3. You can configure your computer so that it can run Linux programs remotely that have a graphical interface.

This document will cover option 3. If you set this up correctly, you will be able to use all the programs that you would have used in the CS lab on your Windows computer. You'll also be able to run multiple programs on the CS cluster at the same time (e.g. a terminal and a text editor) and all of them will show up on your Windows computer. So working on your labs in your room won't be much different from working on them in the CS lab.

If your computer runs Linux already, you don't need this document -- you just need to know this command:

% ssh -X login.cs.caltech.edu

where "%" is the terminal prompt. If your computer is a Mac, this document won't help, but I believe there is an X server that works on the Mac (anyone want to look into this?)

Background

The Linux graphical windowing system is called X11, also known as X Windows, or X for short. Note that "X Windows" has nothing whatsoever to do with Microsoft Windows. Nada. Zip. Zero. Forget I even mentioned it.

"X forwarding" is a feature of X where a graphical program runs on one computer, but the user interacts with it on another computer. If you've ever used VNC or Microsoft's Remote Desktop, it's conceptually like that, but it works on a program-by-program or window-by-window basis.

If both computers are running Linux, it's pretty much transparent. However, if you're sitting in front of a Windows computer, it's a little bit trickier -- not much, though! All you need is an X server that runs on Windows, and an SSH client, both of which are freely available.

A Note on Terminology

In X parlance, the "client" is the computer running the program, and the "server" is the computer you're sitting in front of. This might seem backwards: normally the server is the remote computer that's serving you.

Think of it this way: the X server is serving you, the human being, to the programs on the remote computer. The client, a program, makes requests of you through the X server by changing its graphical display, and you respond to it by clicking on it or typing into it.

What You Need

SSH Client

I'm going to explain how to do this with PuTTY, a free and very powerful SSH client for Windows. You can find it here.

You don't need to install PuTTY; just put it in a convenient place and run it. You can leave it on your desktop, or put it in "Program Files" and create a shortcut to the program in your Start Menu. Or you can install it if you like.

X Server and Fonts

You can get the standard X.Org X server ported for Windows; it's called XMing. Actually finding the installer files is a pain, so here are some direct links:

You need both of these!

Now, install both these packages. They have nice Windows installers, so this should be pretty straightforward. Make sure that you put both of them in the same directory (it will do this by default -- be sure to say "yes" even though the directory already exists).

Making It Go

Start XMing

You should have a Start Menu item for XMing. Go ahead and start it. If you're using a firewall, it'll ask you if you want to unblock it. You don't need to.

Look for the "X" icon in your system tray. Hover the mouse over it: it should say something like "Xming server - 0:0". The last bit should be "0:0", but if it's not, pay attention to that and use it below.

PuTTY

I'm assuming you're currently using PuTTY. If not, there's some good documentation on the PuTTY website. It's also very easy to use, so you should be able to start using it without much trouble anyways.

First, open PuTTY. Then, put in your normal settings for connecting to the CS cluster: under host name, put "your-username@login.cs.caltech.edu".

Then, on the left, click on the Connection/SSH/X11 sub-panel. It'll have a few options. Check "Enable X11 Forwarding", and in the "X display location", put "localhost:0:0" in the box (unless you didn't have "0:0" in the section above: then use "localhost:x:y", where "x:y" is whatever you saw on the icon). Leave the radio button on "MIT-Magic-Cookie-1".

Now click back to the main "Session" panel on the left. Put a name (like "CS + XWindows") in the text box in the middle right below "Saved Sessions". Click the "Save" button. From now on, you can double click the connection in the list box when you want to connect to CS; you don't need to do these settings every time.

Press "Open" to start PuTTY. Put in your password or do whatever you do to authenticate. Now run the command "xeyes &". You should get a big pair of googly-eyes that follows the cursor around. It works!

Tips and Tricks

If you have any questions about this document, please don't hesitate to contact us!