In a previous article, I discussed how to install and use the open source product cygwin
™ from a Windows laptop to access a UNIX workstation (such as an IBM pSeries server running AIX 5L). This conveniently allowed the same keyboard, video display screen, and mouse (KVM) to be used for both machines.
One feature that was missing from the original setup was the ability to use X clients (such as xterm, xclock, or smit) that are started on the UNIX workstation from the laptop. Even though it was free, I had recommended against using the cygwin X server software because I found it inconvenient. It created a separate window for the X root window (the "desktop") instead of displaying X clients in the familiar Windows desktop.
Until recently, only commercial X servers available for Windows were able to use the Windows window manager. They range from relatively expensive programs, such as Hummingbird Exceed, to cheaper alternatives such as LabTam XLitePro (previuosly XThinPro) and MicroImages MI/X.
However, now there are two free alternatives that work nearly as well as their commercial brethren. Both cygwin (from Red Hat) and uwin (from AT&T Research) support so-called "multiwindow" Xserver modes. This allows X client displays to use the same Windows window manager as regular Windows programs.
Before starting, it is important to have some experience using the X windowing system under Unix, especially the different ways that X windows can authenticate client applications from remote servers. Explanations of this are available on the Web and from any number of books on Unix and Linux; they are beyond the scope of this presentation.
The uwin and cygwin directory hierarchies overlap, so only one of them can be installed at a time. Neither overlaps with the commercial Xservers, so you can still choose to keep a base uwin or cygwin installation and add a commercial X server.
For simplicity, I assume that the /etc/hosts files on both the remote and local machines have assigned names to all of the IP addresses on the network that would be needed. This conveniently allows the use of host names instead of IP addresses in commands, though either can be used.
"Explorer" refers to the Windows file manager, not the Internet Explorer browser application.
The terms "local host" and "Windows computer" refer to the same network node in the following discussion. Any command which uses <…> needs to have an appropriate value substituted for the <…> string. For example, a command xhost <local host> should actually be entered substituting the name of the Windows computer for <local host>.
Installing and configuring Cygwin
Refer to Working on UNIX through your laptop for a complete version of the initial steps.
- Install cygwin setup.exe on the Windows computer. You can download it from http://cygwin.com/. Just click on the "Install now" icon.
- Run
setup.exe. A wizard will guide you through the install process. Eventually, the wizard displays a list of package groups. Switch the View menu option to "full", allowing you to browse packages by name. When selecting packages, be sure to add, at least, the xorg-x11 packages to the default list. I also recommend adding the openssh package, to allow ssh tunneling for remote X clients. (I’ll explain this later.) Add other packages, perhaps more fonts or widget packages like lesstif, as desired. I like the wget and ncftp clients. - Open a cygwin window. Use hostname to check the name of the local (Windows) host. This should also be an entry in all /etc/host files for all nodes on your LAN.
- The cygwin X server supplies a startup script -
/usr/X11R6/bin/startxwin.sh. Running this script gives you a basic X server. In the script, the line that invokes the server starts with Xwin. - To use the X server from a remote machine, set the DISPLAY environment variable on remote UNIX servers with the local host name. For example (in ksh or bash):
export DISPLAY=<local host>:0.0
- The script also contains a list of other options that you can use. For example, try the
-multiplemonitorsoption if you have more than one display attached to your Windows laptop. - Unlike other X servers, the cygwin X server does not disable X client access control. Before starting any remote X clients, you normally need to supply the appropriate permissions using
xauthorxhost. To run X clients from <remote host> on your local Windows X server, enter the following command on the local host:xhost <remote host>
- Check that the DISPLAY environment variable on the remote host is set correctly and run xclock from the remote host. You should see the clock display on the Windows Desktop.
- Another way to allow remote X clients to access the cygwin X server is through ssh X tunneling. In this case, you need to enable the
sshddaemon on the remote machine to do X11 forwarding.For example, assume that there is a remote host running AIX 5L with openssh installed. As root, you need to change the file /etc/ssh/sshd_config. Find the line
#X11Forwarding noand change it toX11Forwarding yes. Then stop and restart the server:stopsrc –g ssh startsrc –g ssh
Then, from the Windows computer, log into the remote host using ssh –X <login ID>@<remote host>, substituting your own particular values for <login ID> and <remote host>. The ssh session should automatically set the DISPLAY environment variable to allow remote X clients to use your local display. Use xclock to test the tunnel from the remote host.
Installing and configuring U/WIN™
- From the uwin home page, go to the download page, choose the license you want, and follow a link to the binary downloads page.
- At a minimum, you need the uwin_base and uwin_xbase downloads. I also recommend downloading the uwin_xfonts package. Include any other packages desired, accept the license, and download the packages and associated README files to a directory. Additional (open source) packages are available from http://www.wipro.com/uwin/uwinSuDaPoA.html and http://www.pauahtun.org/sshd.html.
- From Windows Explorer, double-click on each downloaded executable in turn. uwin_base should be installed first, though the order doesn't seem to matter after that. Install all of the executables before proceeding.
-
uwinwill work under Windows 95 and 98, but works best under Windows 2000, XP, and other NT derivatives. To open a command window (also known as a console window), use Explorer to go to the installation directory (probably C:\Program Files\UWIN). Change to the usr\bin directory and double click on login.exe. In addition, the README file has two alternative ways of startinguwin. -
uwinuses UNIX path name syntax (for example, /usr/bin). The root directory is theuwininstallation directory. C:\ can be accessed by cd /c . -
uwinmight have trouble creating a home directory and default to using /tmp instead. The expected home directory can be added by hand later. -
uwindefaults to using ksh, though the bash shell is also available. The default command line interface of ksh is very similar to whatcygwinoffers in its bash shell. Theuwindocumentation explains how to customize the login environment similarly to other UNIX environments (the key file is /etc/profile). - To start the X server so that it runs with the Windows window manager is almost anticlimactic. From a
uwincommand window, the command /usr/X11/bin/xrun is a script that starts up the X server in "rootless" mode. The key command line argument to the server is-multiwindow. - You will see an X server tab in the Taskbar, but no X root window will appear. From a console window, /usr/X11/bin/xclock will verify that your X display is working as planned.
- Like most other X servers for Windows,
uwindefaults to running with X access control disabled (xhost +). This is a large security hazard if you run from remote hosts shared with other users. I strongly recommend enabling X access control and using ssh tunneling, xhost machine authentication or xauth userid authentication instead. - Running X clients from UNIX. As with
cygwin, you can use a console window to connect to a remote (UNIX) server withtelnet,rsh, orssh. The most secure option issshtunneling. Connect to the UNIX server, set the DISPLAY environment variable appropriately (if you ar not using ssh; see Step 9 in "Installing and configuring Cygwin"), and now runxclockfrom the remote host. Thexclockdisplay should appear on the laptop display. Applications likesmitalso run properly.
Running X clients through a VPN
On a final note, it has become common for workers at remote sites to access corporate networks through Virtual Private Network (VPN) services.
VPN clients create secure connections ("tunnels") between a corporate network and a remote user (outside the corporate firewall). VPN clients work by generating a useable IP address for the session that adds the remote computer to the corporate network. A VPN can provide a tunnel for X clients on remote machines to access a local display, just as ssh can.
To use the VPN for displaying remote X clients, you need to identify the address that the VPN generated when you first connected remotely. Running the command ipconfig from a console window will list all IP addresses for the Windows computer. The correct address will be associated with a virtual adapter. It will not be a Local Area connection address. Setting the DISPLAY environment variable to this <IP Address>:0.0 on any remote host reachable through the VPN will now allow complete the local computer to display any remote X clients (to run a graphical debugger, for example).
The following is a sample output from ipconfig while a VPN client is running:
Windows IP Configuration
-
Ethernet adapter Local Area Connection:
-
Connection-specific DNS Suffix . : ibm.com
IP Address. . . . . . . . . . . . : 192.168.190.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.190.1
-
Ethernet adapter AGN Virtual Network Adapter:
-
Connection-specific DNS Suffix . : ibm.com
IP Address. . . . . . . . . . . . : 9.65.226.11
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . :
|
The VPN IP address in this case is 9.65.226.11. Note that the other address is for a local network and would not be useable except within the local network.
Whether you decide to use a commercial or free X server, you can now enjoy running the same environment from your laptop as you could when directly connected to a remote machine's console terminal. The only difference is the window manager and the response time.
Brad Elkin is a Senior Technical Consultant for IBM eServer - AIX systems and Linux clusters, focusing primarily on Life Sciences applications. He provides support to ISVs for porting applications, problem determination, application performance tuning, and application benchmark design and execution. He holds a PhD in Chemical Engineering from the University of Pennsylvania.





