Using a Windows CYGWIN X Client


  1. Introduction
  2. Requirements
  3. Step by Step to a *NIX server ( simple )


Cygwin is a collection of Unix tools that have recompiled to work within a *NIX( UNIX/Linux )-like shell on Windows. This allows a user to use the same commands through the Cygwin bash shell ( just like the *NIX bash shell ) command prompt. One of the optional programs that could be installed with it is the X Windows Client software. Using this, a Windows user can display a graphical GUI program ( bitmap graphics, not just text graphics ) to the local ( Windows ) system and interact with it as if it was running locally. But it is not, it does not have access to local files and resources, just displayed onto and accepting mouse and keyboard input from the local machine.


You must have the following to do this:

  1. A Win32 version of Microsoft Windows on your local system ( Windows XP/2000/NT/Me/98/95 )
  2. An account on a *NIX system ( in our labs, they are: Yoda, Lucas, any system that you can ssh into )
  3. A Network connection ( Dial-up, Cable modem, DSL, Direct Connection, etc. )
  4. Cygwin Utilities, including the X Windows Client Software, installed on your local machine. Directions available here.
  5. Putty, a free telnet/SSH client tool, available though here

Step by Step to a *NIX server ( simple )

Here is a step by step instructions list. This works in our Windows Labs where we already have Putty and Cygwin installed. It should work similarly from home, but with some differances noted.

  1. Login to your local Windows system and connect to the internet if needed ( Dial-Up users )
  2. Start the Cygwin X System. If you installed to the default location, C:\CYGWIN, this would be:
    1. Click on Start->Run
    2. Click on the Browse button
    3. Navigate to the C:\cygwin\usr\X11R6\bin\startxwin.bat file and click the OPEN button
    4. Click on the OK button
    You should see an icon show up in your system tray that looks like the letter X and you should see a bash shell window open. DO NOT CLOSE EITHER UNTIL YOU ARE DONE USING X WINDOWS ALTOGETHER.
  3. Now you need to start an ssh session to the remote *NIX server. Here are going to use Putty to connect to the remote *NIX server, at the same time we are setting Putty's SSH to setup X Windows Tunneling. This allows the remote *NIX system to interact with your local X Windows program without having to open a seperate connection. This is important if you system is not using a dedicated IP Address known directly on the Internet ( ie: Dial-up, Cable modem, DSL, Internet connection sharing, behind a firewall, et al. ):
    1. Run Putty
    2. Type the server name into the Host Name field
    3. Click on the SSH selection for Protocol under the Host Name field
    4. Enable X Windows fowarding:
      1. Under the Catagory list on the left hand side, double-click on Connection item to expand it's list, if it is not already displayed
      2. Now double-click on the SSH item to expand it's list, if it is not already diksplayed
      3. Click once on the Tunnels item to display it's properties display
      4. Click on the Checkbox to enable Enable X11 fowarding
      5. Optional: Increase the number of scroll lines you record and can scroll back through in your SSH session
        1. Click on Window item under Catagory to display it's list
        2. increase the number of scrollback lines in the Lines of scrollback field
      6. Optional: Choose a different font color
        1. Click on Windows->Colours under Catagory
        2. Select Default Forground, if it is not already selected
        3. Click on the Modify button
        4. Click on the color you want your text font to be
        5. Click the OK button
      7. Optional: Save these settings for future use
        1. Click on Session under Catagory
        2. Enter a word/name into the Saved Sessions field. This is just a text string that then will show up in the list below this field, it is not the hostname to connect to. So you can use the hostname, the short version of the hostname or even some made up phrase.
        3. Click the Save button to the right of this field
      8. Click the Open button at the bottom of the window to connect to the named hostname
      9. When prompted about a security host key/number, just click the Yes button oto accept it
      10. You should now be prompted for username and password as normal when connecting to the *NIX server. If you enter the wrong username, there is no easy way to go back, so:
        1. Right-click on the normally Blue bar that is the top of the Putty session you had just opened. This will show a menu to the Putty program
        2. From this menu, about half way down is Duplicate Session . Click on it.
        3. You should now be prompted for username again, close the original window
  4. In the Cygwin Bash shell window that came up when you ran stratxwin.bat, type the following command, substituting the remote *NIX server's name in place of "server"
    xhost + server
    and press ENTER ( or RETURN on some keyboards ). This will tell the local ( Cygwin's ) X Windows Client to accept connections from "server"'s X Windows Service.
  5. Now run a graphical GUI program on the remote *NIX server to test that it works. If you did not already have something in mind, just try:
    xterm &
    xemacs &
    xeyes &
    The "&" at the end of the command tells *NIX to "background" the process. This means that the *NIX prompt will return right away, waiting for the next command, instead of waiting until the current command ( window ) ends.
  6. REMINDER: The programs act as if they are running on the local computer, almost, but do not forget: they are actually running on the remote server. They do not have access to local files and resources. They rely on the network and SSH connections to stay open to keep working. And you need to close any X Windows GUI programs before you logout of the SSH session or close your network connection ( Dial-up users )