Interoperability MobaXterm: Unix for Windows Lead image: © Henner Damke, 123RF.com
© Henner Damke, 123RF.com
 

Taking that Unix and Linux feeling tothe Windows desktop with MobaXterm

False Laurels

MobaXterm, a portable X server for Windows, bundles built-in Unix/Posix tools into a single portable EXE file, letting you use a Linux command line and tools on the Windows desktop. By Thomas Drilling

An X server running on Windows is interesting to two user groups. For Linux administrators who occasionally use a Windows computer, it provides an easy way to manage the Windows computer with Linux commands. If necessary, support for remote login and the use of popular remote tools on Linux machines are also available. On the other hand, Windows users who are ready to make the switch to Linux can experiment with Linux commands, Linux syntax, and the Linux directory structure from their Windows computer. MobaXterm is designed as a portable one-click EXE, so it eliminates what would otherwise be a time-consuming installation.

Feature Scope

MobaXterm functionality goes far beyond providing a Linux terminal in Windows, in that the EXE file contains the essential Unix commands and a session manager that provides all the important remote network tools (e.g., SH, RDP, VNC, Telnet, Rlogin, FTP, SFTP, and XDMCP). X11 forwarding is supported by OpenSSH. The full MobaXterm package thus consists of the embedded X server, the tab-enabled terminal with embedded Unix commands (e.g., ls, cd, cat, sed, grep, awk, rsync, wget), and the session manager. A free version 4.4 is available for download [1] on the project site [2], and a professional version with advanced capabilities is available for EUR 49. A feature list [3] specifies the differences between the free and pro versions.

The terminal function supports anti-aliasing, fonts, and macros, and a plugin interface allows you to add features; however, these are mainly Unix and X11 tools that were ported from Cygwin. The project site [4] has a considerable number of plugins up for grabs (Table 1), and several third-party tools are available as well. Additionally, the free version's Zip archive contains MobaXterm_Personal_Customizer_4.4, which you can use to customize the appearance of the tools.

Tabelle 1: MobaXterm Plugins

Plugin Name

Function

Emacs

The cult editor for Unix admins.

Fontforge

A powerful font editor.

Gcc, G++, and development tools

Complete GNU C(++) development environment.

Gvim

The popular Vim editor, with a Gtk interface.

MPlayer

One of the most powerful media players ever, but without a GUI by default.

Perl

Perl programming language.

Corkscrew

Corkscrew plugin that can tunnel TCP connections through an HTTP proxy.

Connect-Proxy

Plugin from the same Debian package that also enables tunneling of TCP connections via SOCKS or HTTP proxies.

Tcl/Tk/Expect

Provides a complete Tcl/Tk development environment.

Screen

A terminal multiplexer that allows a separate session on a simple character-based terminal.

Png2Ico

The Png2Ico plugin converts PNG images into Windows Icon Resource Files.

Nedit

Another X11 editor.

Midnight Commander

Norton Commander's popular file manager clone from DOS times.

Subversion (SVN)

Provides access from MobaXterm to the Subversion version management system.

Git

Provides access from MobaXterm to the Git version management system.

FVWM2

One of the first and oldest Windows managers for X11.

Xorg (legacy)

Installing the old X11 (Xorg v1.6.5) is only necessary if you have problems with XDMCP access to an "old" Unix or Linux workstation.

DnsUtils

Provides MobaXterm with Linux/Unix's own DNS (dig, host, nslookup, nsupdate).

PdKsh

Open source implementation of a Korn shell.

Exif

A command-line tool that displays hidden Exif information in JPG images.

Lynx

An aged (but still sometimes useful) text-based web browser.

E2fsProgs

Utilities to create, repair, configure, or debug ext2/3/4 data systems.

Walk-Through

When you first start MobaXterm, an alarm might be activated by Windows Firewall. If you then type allow, you can define a suitable rule. Then, MobaXterm will show you a local terminal session, including some references to the default configuration. The prompt comes up in the typical Unix manner, showing you <User>.<Hostname>. All drives available in Windows (as well as connected network drives) are available in typical Unix style as mountpoints below /drives.

The home screen provides information about the current IP address and the session display number. The Banner with precisely this information can be configured individually in the Pro Version's MobaXterm_Personal_Customizer. Because MobaXterm is based on Cygwin, a complete Linux directory structure is available to Windows administrators interested in the Linux adventure (Figure 1).

On Windows, MobaXterm provides a complete Unix environment with a classic directory hierarchy.
Figure 1: On Windows, MobaXterm provides a complete Unix environment with a classic directory hierarchy.

The GUI is straightforward, even if the toolbar seems to be a little crowded. Linux admins probably won't be all that impressed by the nifty icons with mirrored optics; more skins are available in Settings | Configuration | Display Settings. The settings in Terminal Settings (Fonts, Charset), X server settings (Font Server), and, above all, SSH Settings are even more important. In the SSH section, you can, for example, activate a graphical SSH browser or X11 forwarding (e.g., SSH Agent Forwarding).

Additionally, you can enable the SSH agent. You can then define the private key so that the SSH agent will automatically handle authentication. The SSH agent retains the key in its memory until the client logs out, and you only need to enter the passphrase once. Most Linux distributions automatically start the SSH agent in the background. If you type

ssh-add -i

the SSH agent will list the keys saved at the time. If you change any settings here, you will need to restart MobaXterm. At the left of the terminal window is a navigation pane with two tabs: Sessions and Tools. The first tab is used to toggle between active sessions, (MobaXterm is capable of multiple sessions), which can be saved in Sessions. In general, the GUI is extremely flexible, and depending on the intended use, a number of views can be accessed through the same menu.

The Tools tab (Figure 2) lets you access a number of mainly obsolete Terminal games and some useful system and office tools, including a separate editor, MobaTextEditor, and a built-in image viewer, MobaPictureViewer. The same programs are also available in the Tools menu. For example, List Running Processes shows the current task list in a new terminal tab in typical Unix Top style. In the default setting, the X server is identifiable by the green X server icon at the top right. If it isn't running, it can be restarted at any time by selecting X server in the menu. The List open network ports system tool (Figure 3) is useful for a quick security check.

MobaXterm offers a number of useful system tools in the Tools menu.
Figure 2: MobaXterm offers a number of useful system tools in the Tools menu.
The openports tool will quickly show the ports that are accessible on the Windows host.
Figure 3: The openports tool will quickly show the ports that are accessible on the Windows host.

At the command line, you can browse the Windows filesystem in typical Unix style. You can also carry out file operations, view or edit files, or use other Unix tools.

SSH Tools

A feature that some administrators will definitely appreciate is the navigation section on the SFTP tab (Figure 4), which appears when you click the New session button, choose <SSH>, and click Activate the graphical SSH browser when connected.

The graphical SFTP Browser makes navigation easier in remote file transfer scenarios.
Figure 4: The graphical SFTP Browser makes navigation easier in remote file transfer scenarios.

It is well known that SSH can be used to redirect the X11 screen output of a remotely launched Unix program to a local display (X11 Port Forwarding). SSH tunnels and encrypts the transferred image content and settings. To do this, you need to select the /etc/ssh/sshd_config file's X11Forwarding Yes option server-side. In most Linux distributions, this is the default setting. The option Enable X11 Forwarding in the MobaXterm settings must also be selected. After doing both of these things, you will be able to log in to the system as follows:

ssh -XC <Username>@<Servername>

The -X ensures that SSH gets ready to transfer X11 files as soon as a connection is established. The -C option enables compression for the transferred screen content. After logging in with MobaXterm in Windows, you will be able to run any graphical X11 program on the remote Linux host; the program's screen content will then immediately be redirected to the Windows screen (one example of this is XEmacs; Figure 5).

Thanks to XDMCP, MobaXterm also puts X11 programs on the Windows desktop.
Figure 5: Thanks to XDMCP, MobaXterm also puts X11 programs on the Windows desktop.

Obviously this only works for "real" X11 tools. However, you will probably be aware of the huge selection of capable X tools on any modern distribution. Typing x-Tab reveals many of these. Additionally, the whole repertoire of SSH functions is available to you with MobaXterm on a Windows computer – including a safer, ad hoc VPN solution in the form of port forwarding. A recent article [5] describes this and other useful SSH tricks.

Other Remote Sessions

As well as SSH and SFTP, MobaXterm also provides easy access to other types of remote sessions within Windows (e.g., Telnet, RSH, RDP, VNC, FTP), and, as befits a terminal, it also supports serial connections. You can even start a DOS shell. To configure and use the other types of remote sessions, just click on Sessions | Xdmcp and then set up the different types of sessions in the Session Settings dialog.

The X Display Manager Control Protocol (XCMCP) is a key feature of the X11 architecture. Together with XDMCP, the X network protocol allows distributed operation of the X server and X display manager. The requesting X server runs on the client (usually as an X terminal), thus providing a login service. This explains why the X server ported to MobaXterm with some help from Cygwin also supports XDMCP. If, for example, you want to start a VNC session with a remote VNC server, all you have to do is enter the remote VNC server's IP address in the VNC area; the default VNC port is already registered. Figure 6 shows how easy it is to access a KVM hypervisor virtual machine via VNC.

MobaXterm also enables quick graphical access to a VNC session.
Figure 6: MobaXterm also enables quick graphical access to a VNC session.

Accessing the remote Windows server via RDP or configuring an FTP connection is just as easy and just as fast. Each type of session can be saved in the Sessions tab under any name, stored on the Windows desktop so that it can be loaded quickly, or both.

Unix Tricks

Of course, MobaXterm also provides an inexhaustible repertoire of tricks based on proven Unix tools like awk, sed, grep, and so forth. Experienced Linux administrators can thus use their trusted tools on Windows, and Windows users just might find some applications that CMD doesn't provide.

ImageMagick support is one small example. Windows has no equivalent to this extremely powerful command-line tool set for image processing. A typical practical scenario is simultaneous cropping and scaling of a large number of photos that have different output formats (e.g., for a picture gallery), as shown in the following code example:

Cd photos
mkdir standardphotos
For i in .jpg ; do convert $i -resize 600x350 -gravity center crop 480x320+0+0+repage standardphotos/$i; done

MobaXterm's core functionality is its Cygwin compatibility layer, which also contains a port from the original XOrg server to the Cygwin environment. The Cygwin/X version contained in MobaXterm (1.7.5-1) uses the original X release 6.8.99.

Cygwin [6] is a set of tools that provides the look and feel of a Linux/Unix environment within Windows. The pivotal point is the cygwin1.dll file, which, as a compatibility layer, supports critical Linux API calls. This makes it possible to port programs for Posix systems like Unix, Linux, or BSD to Windows.

Posix programs configured by Cygwin will generally run on any version of Windows from NT (Windows 2000, Windows XP, Windows Vista, Windows Server 2003). Since the Cygwin version 1.7, they will also work on Windows 7 and Windows Server 2008. Only very old and simple Posix programs will run Windows 9x.

Cygwin accesses local partitions as /cygdrive/c, /cygdrive/d, and so on. Windows shares are available in //host/share/file. To keep things simple, MobaXterm maps all drive access to /drives, as mentioned earlier. With the help of the X server started by startxwin.bat, MobaXterm can run local Linux programs built for Windows and display programs running on a Linux computer in Windows. Cygwin lets Windows computer users log in directly to a Linux computer via XDMCP. To do so, Cygwin uses the startxdmcp.bat script. Cygwin even allows you to set up an SSH server as a Windows service.

Conclusions

MobaXterm is undoubtedly a very useful and versatile tool. Functionally, the software is well mannered, and Windows users who want to sniff a little Linux/Unix air can get a good idea of how Linux works. A closer look reveals that anything you can do with MobaXterm can be achieved directly with freely available tools (Cygwin) and Unix tools ported from Cygwin. However, although Cygwin provides a non-Posix environment for Windows, it doesn't offer a decent terminal, which is one thing MobaXterm has going for it.

Admittedly, in pure vanilla Cygwin, you can start an X server automatically and then use xterm, but xterm lacks good-quality fonts, whereas MobaXterm conveniently lets you integrate a font server.

Mobatek's claim that the MobaXterm features are its own developments is also slightly off-putting. As an alternative to MobaXterm, you can now also use the Cygwin PuTTYcyg [7] patch for PuTTY.