Using X Windows remotely from cygwin

Longman, Bill yellowdog-general@lists.terrasoftsolutions.com
Thu May 6 13:38:01 2004


> I have my YDL box in the basement networked with the rest of 
> my machines
> through a router.

Is the router relevant to this? I'm assuming all the machines are on the
same side of the router. If that's so, the router is irrelevant. (I'm just
wondering why you mentioned it because it's not clear to me.)

> [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 /]#
> 
> Now I sort of get the idea that $Display needs to set so that 
> the X Window
> appears on my local machine (the WinXP box) rather than on 
> the YDL monitor.
> But I don't know where (or how) I set it. And I thought that 
> by initiating
> the X connection by using ssh -Y from my WinXP box, that the $Display
> variable would be automatically set.
> 
> When I create the session from X11 on my OSX box, I startup 
> an X11 window
> and then use 'ssh YellowDog -X -l root' and everything works 
> automatically
> without my setting the $Display variable. And yes, I realize 
> that the ssh
> syntax I used with OSX X11 is different from what I used with 
> cygwin... The
> cygwin syntax was taken directly from the cygwin user 
> guide... Besides, I
> tried using the same ssh syntax I use successfully with OSX X11 but it
> doesn't work on cygwin either.

I don't know why the Cygwin folks say to use -Y. I always use -X and it
works fine. I connect that way to machines all over the place -- local net,
home machine, school server, etc. I always get an xterm, once the config
files are right.

Try this from Cygwin:

  ssh -l root -X YellowDog

now, once you're on YellowDog, do:

  echo $DISPLAY

It should give localhost:10.0 or something around there. If it's not, then
you can set your DISPLAY variable manually ala:

  export DISPLAY=Cygwin:0.0

and then fire up an xterm:

  xterm &

If you get permission denied, you need to jump back to your Cygwin session
and allow YellowDog to connect to your X server:

  xhost YellowDog

Note that you need to run xhost from somewhere that knows about and has
access to your X server, like in a local xterm.

Caveat: when you point your DISPLAY to your host:0, you're not going to get
X traffic tunneled. It's just gonna go over the wire au naturel.

Here's the script I use to start X on my Win2k box:

  export DISPLAY=${DISPLAY-":0.0"}
  export XAUTHORITY=${XAUTHORITY-"/cygdrive/l/.Xauthority"}
  XWin -screen 0 1280 1024 &
  sleep 6
  exec ssh-agent wmaker &

and here's the second script I use once X comes up:

  if ssh-add -l
  then
    : #all is cool
  else
    echo Oops...no identities yet. Please add this one.
    ssh-add $HOME/.ssh/id_dsa
  fi
  sunxt sunosbox02
  sunxt sunosbox05
  ssh -f sunosbox02 /usr/openwin/bin/perfmeter sunosbox02
  ssh -f sunosbox02 /usr/openwin/bin/perfmeter sunosbox05
  ssh -f lbox2221 gkrellm
  xhost xeonbox2220 >/dev/null 2>&1 &
  xhost mackey01 >/dev/null 2>&1 &

In case you're wondering, here's what sunxt does:

  exec ssh -f $1 /usr/openwin/bin/xterm -ls


OK. That should get you running, but phase two of this reply is debugging
your problem. Why isn't DISPLAY getting set from your Cygwin box. Check your
ssh_config files. Obviously, the sshd_config file on YellowDog is allowing X
forwarding (X11Forwarding yes) because you're getting X sessions from OSX.
Do you have a config file in your .ssh directory on Cygwin? You could just
make one of those and put "ForwardX11 yes" in there and Bob is, once again,
your uncle. You should also look in /etc/for the ssh_config file and see if
there are any settings in there that may be causing you grief. You might
want to add a YellowDog Host section and put specific settings in there.