Tuesday, April 22, 2008

SSH client and X server for Windows

If, like me, you enjoy connecting/frequently connect remotely to either a cluster/grid computing system or even a UNIX/Linux box, you'll probably be familiar with the Secure Shell (or SSH) which is normally pre-installed in some shape or form.

Those on Windows have to install a third-party application unless you plan to remote desktop into a machine (which, might I add, is not the "best" option when connecting to grid computers, etc.). So I shall attempt to delve into the Win32 side of things for a change as some colleagues recently had a spot of trouble SSH-ing into the University Grid service, Iceberg.

I have already described one use for SSH although is by no means the only thing that can be done. SSH is useful in sending command-based instructions to and from a remote computer. If, however, you wish to do something outside a terminal/command window (besides leaving the computer), one can use an X server (also fondly referred to as X11). The X server is an application which can display some form of GUI (in the form of a window) by providing a framework to the operating system for drawing and moving windows (and most of us took this for granted!). Again, with UNIX/Linux system, an X server is normally packaged with the operating system (unless you're adamant in sticking with console/command based operating systems only).

Those that use (m)any of the distributions of Linux (and possibly UNIX) may know that SSH is mostly likely going to be from the OpenSSH group which distributes both client and server-side software. Likewise, the X server is provided by the X.org Foundation (which has a pretty predictable domain name making me wonder which came first) although it is possible that different operating systems use slightly customised versions of the X11 server (e.g. Apple (surprisingly)).

So let's go into a Windows frame of mind... we have no X server, no SSH and different commands. Whilst some would give up at this point, others will persevere abd reap what few benefits you'll get from this. Two applications spring to mind (again, there are many out there, but these are the two I'd recommend) and these are PuTTY (for SSH-ing) and Xming (which provides the X window for Windows). Xming also includes an adapted version of PuTTY which can lead to problems as I'll describe later (but not that far away in the distance). Putty provides Windows users with a means to SSH, rlogin (that's the remote login protocol) and telnet (although this option exists for many of the Windows installations) whilst allowing the connection to the configured (and, believe me, there are many options for the SSH user).

The other day, a friend asked whether it was possible to access Iceberg in Windows without having to install the Hummingbird suite (which requires a licence to be purchased). Knowing a few open source alternatives, I directed my friend to PuTTY and Xming. It turns out, they already had PuTTY and had customised the default settings to access one of the few Sun machines in the laboratory. We therefore proceeded to continue with the Xming installation (fonts inclusive) and set this up. This is when we began encountering problems as when we attempted to use SSH with the X window setup, we were unable to connect despite having entered the correct password numerous times. After a few attempts, I looked into how Xming works in our setup. The adapted version of PuTTY is what raised my suspicions and so investigated this area. I had suspected that the original (untouched) PuTTY was saving the default settings within Windows Registry and that the adapted version was also referring to the very same settings (so wasn't as altered as it perhaps could have been). To verify this, one would require access to the registry keys (oh joy). Luckily, this was quite simply...


I deleted the registry key/branch such that PuTTY was no longer in registry (at this point, I'd like to remind the read that Windows registry is quite a dangerous toy and should be used with care. Not taking care can result in temporary death of Windows and/or its applications which may or may not require result in its re-installation. The author(s) take no responsibility for themselves or the actions/inactions of the reader). The registry key can be recreated easily by simply running the PuTTY (obviously, this doesn't work should one wish to restore the entire contents of registry had one accidentally deleted the parent branch). From here, Xming could function without the need to constantly prompt for passwords. From this, I don't advise people to make changes to their default profiles within PuTTY; should they do, Xming is not guaranteed to work.