Using X Windows remotely from cygwin

Mike Parson yellowdog-general@lists.terrasoftsolutions.com
Thu May 6 08:44:02 2004


On Wed, May 05, 2004 at 05:52:29PM -0400, Douglas Denholm wrote:

<snip>

> I can make a basic commandline ssh connection from cygwin to the YDL box but
> when I try and set up an X Windows session, it dies.
> 
> I am using the command "ssh -Y -l root YellowDog" under cygwin (the syntax
> suggested in the cygwin user guide). This prompts me for the root password
> on the YDL box and then initiates a commandline on the YDL. But when I try
> to use X (for example by typing "startkde") I get the following behavior:

> [root@YellowDog/]# startkde
> rm:cannot remove '.' or '..'
> rm:cannot remove '.' or '..'
> xsetroot: unable to open display ''
> xrdb: Can't open display ''
> xset: unable to open display ''
> xset: unable to open display ''
> xset: unable to open display ''
> startkde: Starting up...
> ksplash: cannot connect to X server
> kdeinit: aborting. $Display is not set.
> Warning: connect() failed: No such file or directory
> ksmserver: cannot connect to X server
> startkde: shutting down...
> Warning: connect() failed: No such file or directory
> Error: Can't contact kdeinit
> startkde: Running shutdown scripts...
> startkde: Done
> [root@YellowDog /]#

Have you started the X session on the Win32/Cygwin box?  From the errors
you show above, it looks like you haven't.  If you were, you would
most likely get an error more like "another window manager is already
running."

If you want to run X programs on your YDL (or any other Unix host) and
have them display on your Windows host under cygwin's X11, then you
need to start your X server on the windows box first.  IIRC, there's a
startxwin.bat file that you can double click on that will fire up X in
'rootless' mode, which lets you use the local Windows Explorer interface
to manage the windows, it should also fire up a single xterm.  From
there, you would ssh to your Linux host, then to test if X11 forwarding
is working, start with something simply, like xlogo, which if all is
configured properly, will display a graphical X11 logo on your screen.

Control-C or click the 'x' up in the corner of the window to kill that
'client' and you'll have your prompt back in the xterm.  Now you can
fire up other programs, mozilla, OpenOffice, emacs, whatever, and their
X display will show up on your windows box.

If you want to use KDE from your YDL box full-screen on your windows
box, then you need to do a bit more.  First, you need to configure the
display manager to allow xdmcp connections, I believe the default DM is
GDM (the Gnome Display Manager), but that could depend on which setup
you chose.  For GDM, edit /etc/X11/gdm/gdm.conf and look for the area
under [xdmcp]:

...
[xdmcp]
# Distributions: Ship with this off.  It is never a safe thing to leave
# out on the net.  Alternatively you can set up /etc/hosts.allow and
# /etc/hosts.deny to only allow say local access.
Enable=false
...

Change that to:
Enable=true

And restart X (control-alt-backspace should be enough), if you're running
in init level 5 (graphical login).

Then from your Windows box, start a cygwin bash session, then type:

X -query hostname.of.YDL.box -once 

And if all is well, after a few seconds you should be greeted with a
login screen from your YDL system, log in, and you should get your KDE
screen as though you were running localy, but probably a tad bit slower,
KDE pushes a lot of stuff across the wire.

-- 
Michael Parson
mparson@bl.org