Everything In Between

The brutally honest, first-person account of Meitar Moscovitz's life.

Cygwin SSH X11 Forwarding Doesn’t Set Environment Properly

8 comments

I have spent the past 5 hours pouring over the Cygwin/X FAQ and countless mailing list archives but have turned up empty. In brief, I am having trouble getting my Cygwin X Server to receive forwarded X11 connections.

More specifically, when I ssh -X user@remote-host from the Cygwin XTerm, the remote-host doesn’t have a DISPLAY environment variable set. Obviously, this is bad, because it means the X11 forwarding doesn’t have a display to go to (i.e., it is b0rk)!

I’ve tried to ssh -vv -X user@remote-host to get some interesting debugging output, but the only X11-related messages I get are too cryptic for my understanding:

debug2: x11_get_proto: /usr/X11R6/bin/xauth -f /tmp/ssh-UbLPAD1860/xauthfile generate 127.0.0.1:0.0 MIT-MAGIC-COOKIE-1 untrusted timeout 1200 2>/dev/null
debug2: x11_get_proto: /usr/X11R6/bin/xauth -f /tmp/ssh-UbLPAD1860/xauthfile list 127.0.0.1:0.0 . 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
debug2: channel 0: request x11-req confirm 0

The bit about “authentication spoofing” is unnerving. Could this “spoofing” simply not be working? If that’s the case, then the problem has something to do with the way xauth(1) is configured, no? (Yes, I’ve poured over the man pages as well, but to no avail. As far as I can tell the output fom xauth -v list is fine.)

Additionally, I’ve got doubts about whether or not it is okay that the xauth data is being written to a temp file like that with xauth ... generate .... Note that there doesn’t seem to be any problem forwarding the display of X client programs to a different server, only the other way around (forwarding other displays to my Cygwin X Server) causes problems.

Am I missing something really stupid?

After some more fiddling, I have gotten it to work if I set $DISPLAY manually through the SSH connection. That is, after I

Cygwin-Box$ ssh user@remote-host
Remote-Host% setenv DISPLAY "192.168.1.102:0.0"

then

emacs&

will work and its display will appear on Cygwin-Box. But why doesn’t ssh -X ... do this automatically?

Anyway, if anyone has any idea why SSH isn’t setting $DISPLAY for an X11 connection, I’d really appreciate some advice. Thanks in advance.

Written by Meitar

December 20th, 2004 at 2:22 am

8 Responses to 'Cygwin SSH X11 Forwarding Doesn’t Set Environment Properly'

Subscribe to comments with RSS or TrackBack to 'Cygwin SSH X11 Forwarding Doesn’t Set Environment Properly'.

  1. Dayem… Somewhere about 3/4 down the entry I experienced a mental crash… I must admit: WAY WAY above my head. Like FEEEEWWWWwww! – Either you are smart or I am just stupid. Well, I am not stupid, of course, despite what some people think, so the shoe is on the other foot. But I got your jist. Really. I just don’t know what to do with it….

    Nick

    23 Dec 04 at 5:22 AM

  2. I think it’s a bug in cygwin ssh implementation. Looks like remote env aren’t read in properly. .profile, .ssh/environment, and windows env doesn’t work for me either. Looking for a solution :(

    Sean Aitken

    3 Jun 05 at 3:15 PM

  3. Enable X11 forwarding in /etc/ssh/sshd_config on the machine that you connect to.

    Olaf

    5 Jul 05 at 6:13 AM

  4. The DISPLAY environmental variable in Cygwin needs to be set up before you ssh -X blahblahblah, so:
    export DISPLAY=localhost:0.0
    ssh -X blahblahblah
    (you can actually put localhost, or the IP address of the X server).
    Hope this helps,
    Ste

    Ste

    30 Jul 05 at 9:11 PM

  5. try ssh -Yf xterm

    Poor Yorick

    8 Sep 05 at 9:49 PM

  6. uh…. oops… try ssh -Yf user@host xterm

    Poor Yorick

    8 Sep 05 at 9:49 PM

  7. Thanks Ste. The export DISPLAY=localhost:0.0 did the trick for me.

    Don

    29 Apr 09 at 7:21 AM

  8. Same problem for me with ssh (OpenSSH_5.4p1) on MSYS 1.0.16 and Windows XP SP3.
    Running the X-Server Xming 6.9.0.31.

    Problem solved by putting the following in the .profile

    export DISPLAY=localhost:0.0

    Nicola

    21 Oct 10 at 7:59 AM

Leave a Reply