Displaying remote clients

Displaying remote X clients with Cygwin/X is nearly identical to displaying remote X clients with any other X Server. You may use the secure ssh method, or the insecure telnet or rsh method (not recommended).

Secure ssh

On your Windows machine:

  1. Make sure you have the openssh package installed.

  2. Launch Cygwin/X

  3. Ensure the DISPLAY environment variable is set correctly. (This step is not neccessary if you are entering your commands into an X terminal, as DISPLAY must already be set in that case)

    
$ export DISPLAY=:0.0
    
  4. Run the ssh command to connect to the remote host:

    
$ ssh -Y username@remote_hostname_or_ip_address
    
  5. Enter your password when prompted by ssh.

  6. Your ssh session should now show you a shell prompt for your remote machine.

    Note: The ssh server will automatically set the DISPLAY environment variable appropriately, typically to something like localhost:10.0, so clients will connect to a proxy X11 display on the remote host from which the X11 protocol will be forwarded over ssh to your X server.

    If your login scripts unconditionally set DISPLAY to something else, this will break X11 forwarding.

  7. You can now launch remote X clients in your ssh session, for example, xterm& will launch an xterm running on your remote host that will display on your Cygwin/X screen.

  8. Launch other remote clients in the same manner. I recommend starting the remote clients in the background, by appending & to the command name, so that you don't have to open several ssh sessions.

Note: By default, the OpenSSH server does not allow forwarded X connections. This must be configured on the remote host by adding X11Forwarding yes to the sshd_config configuration file. The OpenSSH server must be restarted or SIGHUP'ed to re-read the configuration file after it is changed.

Note: The OpenSSH server requires the xauth command to be available to forward X connections. Consequently, it must be installed on the remote host.

Insecure telnet or rsh (Not recommended)

On your Windows machine:

  1. Make sure you have the inetutils package installed (for telnet) or rsh package (for rsh).

  2. Launch Cygwin/X

  3. In an X terminal, use the xhost command to allow the remote host access to make connections to your X server:
    
$ xhost remote_hostname_or_ip_address
    

  4. Run the telnet or rsh command to connect to the remote host:
    
$ /usr/bin/telnet remote_hostname_or_ip_address
    
    or
    
$ rsh remote_hostname_or_ip_address
    

    Note: Use the explicit path to ensure that Cygwin's telnet is run instead of Microsoft's telnet. Microsoft's telnet cannot read input or display output correctly when run from a Cygwin shell.

  5. Login to your remote machine

  6. Ensure the DISPLAY environment variable is set correctly in your remote session.
    
$ export DISPLAY=windows_hostname_or_ip_address:0.0
    

  7. You can now launch remote X clients, for example, xterm& will launch an xterm running on your remote host that will display on your Cygwin/X screen.

  8. Launch other remote clients in the same manner; I recommend starting the remote clients in the background, by appending & to the command name, so that you don't have to open several telnet sessions.

Note: This is insecure because (1) when you log in, your username and password may be transmitted in clear across the network between you and the remote host (2) the X protocol is transmitted in clear across the network between you and the remote host, and (3) you have allowed any user on the remote host to connect to your X server and monitor your X session. For these reasons, use ssh forwarding rather than telnet, if at all possible.