Spinal Cord Research Centre







SCRC Data Capture and Analysis Software Tutorials

Xming+PuTTY on a Stick

In furthering our goal of enabling users of the SCRC analysis software to analyze anywhere, we've put together a compact, portable set of Windows software to allow easy setup of remote X Window sessions via SSH. It's actually two packages combined together: The Xming X Window server and the PuTTY terminal emulator and SSH client. We've configured these so they can be run from a portable USB memory stick, so we call this setup Xming+PuTTY on a Stick. However, it can also be setup on any Windows hard drive. Our intent was to put together a small and portable X server that was:

  • secure and reliable,
  • easy to use and configure,
  • lightweight (small and doesn't need a complex or lenghty installation),
  • self-contained/portable (could be run from anywhere including a memory stick), and
  • free in both senses of the word (no cost, no restrictions).

To accomplish this, we put together two packages and some of our own configuration files, to make it all work together nicely. The major component is the X Window server. Of the leading free X servers for Windows, we chose Xming over Cygwin/X because we've found it to be a bit more reliable on our systems, and it's also much more self-contained, which makes it more portable. Xming comes in both non-free (donation required) and free versions, which can be downloaded from the Xming X Server web site, but we actually use the free 6.9.0.31 release that was bundled with andLinux as it included a few useful configuration tweaks. We added in an Xminrc configuration file which has an entry for launching PuTTY. We used a modified version of PuTTY called PuTTYtray, mainly to avoid PuTTY's use of the Windows registry for its configuration. Other PuTTY variations are available that use configuration files instead of the registry, but we settled on PuTTYtray because it seems to be actively maintained (some others like portaPuTTY use older PuTTY source and don't have the latest security fixes), and also because it can transfer configurations from the registry to files and back again. Finally we set up Session profiles for our systems, and default settings that include all the features and options we like to use to connect to our systems.

You can download Xming+PuTTY on a Stick from here:

(20 MB ZIP archive, 27 MB uncompressed).
Extract the ZIP file into the root folder of your USB stick, or into any folder on your hard drive where you want to put it. It will create a sub-folder called Xming when you extract it. That's all there is to installing it. To run it, double-click on the icon named Start Xming+PuTTY.bat.

Starting Xming+PuTTY from the USB stick's Xming folder

Xming task bar icon and pop-up menu

This batch file starts up Xming in the background, using a number of configuration options that make it behave the way we want, most notably that it runs in a rootless, multi-window configuration which allows X Window applications to co-exist with Windows applications on the same desktop. These are the same configuration options that andLinux uses, so the appearance and behaviour will be identical.

Once started, Xming puts an X icon in the task bar. Right-click on this icon to get Xming's pop-up menu, from which you can select New PuTTY Session... to start up a terminal connection to one of the capture and analysis systems. This brings up PuTTY's configuration window, from which you can select and start up a new terminal session, as well as set up and save your configuration options for these sessions. Our Xming.zip package comes with pre-defined sessions for all of the SCRC's current data capture and analysis systems, which can be used as-is to connect to our servers, or you can use these as a starting point for new system configurations. To connect to one of these servers, simply double-click the server name in the list of stored sessions. A double-click will do the same as single-clicking the name, then clicking on Load and then Open.

PuTTY Configuration and Session selection window

Important note: PuTTY does not load any saved sessions from file automatically at start up. Unless you explicitly select and load one, it will start up with its own built-in default settings (not the Default Settings from file), which don't enable X11 forwarding through SSH so they won't support X Window applications. So, to connect to a different system than the ones in the sessions already configured, load one of the existing saved sessions from file, change the host name (and login username from the Connection/Data if necessary), then save the session under a new name. Then any time after that, you just need to double-click on the saved session name to open that session on the saved host name. This is described in more detail below.

Once you've opened a session, the PuTTY window will ask you for a password. After that, you should get a command prompt in that window, allowing you to enter commands. Using a remote X session, the mouse buttons should work as expected, though it's likely that Windows won't support the middle button transparently. Any X Window applications that you run from the xterm window, including most programs in the analysis software suite, should open their own windows right on your desktop, co-existing with any Windows application windows you may have running. For some reason, Xming doesn't automatically activate the window that it opens, so you have to click on it before you start typing, to bring it to the foreground and activate it so it accepts keyboard input.

All these sessions are set up to enable X11 forwarding through an SSH tunnel. This allows secure access to X Window applications on our servers from just about anywhere, even from PCs behind firewall systems, or on public networks. The first time you connect to a new system, PuTTY will pop up a Security Alert window, telling you that the server's host key is not cached. This is a security feature that allows PuTTY to confirm that it is indeed connecting to the system you want. It's a good idea to establish your first connection while on a secure network, so you know you're getting the real deal. Click on the Yes button to cache the new key. PuTTYtray will cache new keys in the folder Xming\sshhostkeys, unless earlier PuTTY host keys were previously cached in the registry. On subsequent connections, PuTTY will see that the host key from the connection matches the one it has cached, so it knows that the server is not a fake, even when connecting from an unsecured public network. All data passed between PuTTY and the server will be encrypted, including your user name and password, as well as all data between your PC and any X Window applications you run on the server.

It's very easy to change your session configurations, or to set up new saved sessions in PuTTY as well. Use one of the existing sessions, or the Default Settings, as the starting point. Single-click on the name of one of these, click on Load, and then browse through the options by selecting categories from the Category pane on the left. You can turn off X11 forwarding for a session, to support plain-text terminal sessions with ssh servers that don't support X11, by clicking on the + sign next to SSH, under the Connection category, then click on the X11 category under SSH, and finally uncheck the box labeled "Enable X11 forwarding". (Note: only uncheck this option if you don't want to use X Window applications on that system, or if it doesn't support them. To use X Window applications for a session, make sure the "Enable X11 forwarding" option is checked.) To use a different user name than "exp", which we commonly use on our servers, select the Data category under Connection, and change or clear the text box labeled "Auto-login username". If you leave this field blank, then PuTTY will ask you for your username before you get the password prompt, whenever you open this connection. There are many more options as well, including how the Backspace key and the system bell are handled, the font and colours used, the initial window size and resizing behaviour. When you've set these as required, go back to the Session category at the top, and Host Name (or IP address) for the connection. Then, enter the session name (usually the host name) in the "Saved Sessions" text box, and click on the Save button. The new session name should appear in the list below. By default, PuTTYtray saves sessions in a file (when "Sessions from file" is selected), and these will be stored in the Xming\sessions folder. If "Sessions from registry" is checked before saving, they will go in the Windows system registry instead. For portability, e.g. if you're using a USB memory stick, make sure you're saving and loading sessions from files.

When you're done running your X Window sessions, you should close things up. Begin by exiting all your running X applications, or closing their windows. Then logout from all your PuTTY windows, usually using Ctrl-D, or the exit or logout command. Finally, when all the X and PuTTY windows are closed, you can exit Xming by right-clicking on its task bar icon, and selecting Exit. Xming will ask to confirm that you want to want to exit, and shows the number of clients currently connected. You can usually ignore this number, if you've already saved your work and closed all your windows - the number will include the SSH tunnels opened by PuTTY, which are still counted even after you've logged out. Click on the Exit button to close it all up, and then you can right-click on the "Safely Remove Hardware" icon in the task bar to get Windows to finish with your USB memory stick so you can remove it.


See also: SCRC Software On-line Documentation, SCRC Software Tutorials




© Copyright 2009 G. R. Detillieux, Spinal Cord Research Centre, University of Manitoba. All Rights Reserved. Contact Us for more information.
Revised September 3, 2009.