Displaying X-Window Output Remotely


To run on a remote machine (such as a Windows machine in one of the IT public access labs) and display the X-Window output from a workstation connected to the CS server, you must complete the following steps:
  1. You must get a copy of an X server and the secure shell for your machine (Windows, Mac) and install it. If you are running Linux on your machine, this step is not necessary, since you already have a built-in X server.

  2. For a Mac or Windows machine, start the X-Window server on your local machine. For a Linux machine, the X-Window server will already be running.

  3. Start an using ssh window on your local machine, and login to one of the workstations attached to the CS server. For a Windows or Mac machine, this window will come from a program like putty or F-secure ssh. For a Linux machine, you can simply start a terminal window and ssh to one of the CS workstations (e.g., ssh myloginid@pepe.cs.wm.edu).

  4. If necessary, set the DISPLAY shell variable so that the X-Window output generated on the CS workstation displays on your local machine. Most ssh programs set the DISPLAY variable on the CS workstation, but a few, like putty, don't.

    You can set the DISPLAY variable on the CS workstation as follows. In the ssh window that you have used to login to the CS workstations, type (for the tcsh shell)

             prompt% who
             bynum    pts/1    Aug 30 09:23 (wm60-104.admin.wm.edu)
             prompt% setenv DISPLAY wm60-104.admin.wm.edu:0
             prompt%
    

    Note that the who command supplies the IP name of the machine from which you are accessing the CS server. In this case, the workstation belongs to Information Technology and is located in Swem Library. The setenv command on the next line directs the X-Window display to that machine, where the local X server started in step 1 will display it.

    Information Technology actually includes a part of the IP address of the workstation in the textual IP name of the workstation. The IP domain for the William and Mary network is 128.239.*.*. In the above example, you could also set the DISPLAY variable for that workstation with the commands:

             prompt% who
             bynum    pts/1    Aug 30 09:23 (wm60-104.admin.wm.edu)
             prompt% setenv DISPLAY 128.239.104.60:0
             prompt%
    

    I have a Tcl script that will parse the output of the who command and extract the IP address for any W&M IT location (such as the administrative IP address shown above, or any "resnet" or "unwired" location), Cox High-speed Internet IP addresses, or RCN.com dialup IP addresses. This script should be useful to most of you as it is. Ask me if you need help in modifying the script to work with your internet service provider.

    Using this script, you can set the DISPLAY variable with the command:

             prompt% setenv DISPLAY `~bynum/bin/getLoginIP`; printenv DISPLAY
             prompt%
    
    Those are backticks (`) NOT apotstrophes ('). The backticks get tcsh to execute the Tcl script and stuff its output into the DISPLAY variable. The printenv just checks to see what your DISPLAY variable has been set to.

Back to the class page