Problems with X11 forwarding

10,210

Solution 1

For msys(mingw64), after running Xming, you need to set your $DISPLAY value before running ssh with X forwarding.

I haven't checked cygwin but I guess it's the same(although you'd probably want to run the cygwin X11 server).

export DISPLAY=localhost:0
ssh username@server -X

Solution 2

In addition to setting the display variable as jbcreix suggested by running export DISPLAY=localhost:0 I also had to use -Y instead of -X.

From the man page:

-Y
    Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. 

It disables some security checks and should only be used when logging in on trusted hosts. It is claimed that the security checks are not useful anyway here and here. Ubuntu used -Y by default even for -X for a long time according to this.

Share:
10,210

Related videos on Youtube

Christian Bongiorno
Author by

Christian Bongiorno

Software engineering leader with a patent and over 15 years combined software development experience. I truly enjoy collaborating with others and mentoring Junior developers while working with the product team to build world class software. You can find samples of my work: https://github.com/chb0github/ And my linked in profile: http://www.linkedin.com/pub/christian-bongiorno/3/282/732 My patent: http://www.google.com/patents/US8495068

Updated on September 18, 2022

Comments

  • Christian Bongiorno
    Christian Bongiorno over 1 year

    I am trying to do some X11 forwarding from my windows machine. I have tried:

    • Mingw64
    • Cygwin64
    • putty

    In both Mingw and cygwin I run I get these results:

    $ ssh -X [email protected]
    Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-62-generic x86_64)
    Last login: Tue Sep  1 13:20:14 2015 from 10.5.4.83
    bongioc@ncp-cb-1:~$ firefox
    
    (process:13343): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
    Error: no display specified
    bongioc@ncp-cb-1:~$ xterm
    xterm: Xt error: Can't open display:
    xterm: DISPLAY is not set
    bongioc@ncp-cb-1:~$ export DISPLAY=`echo $SSH_CONNECTION | awk '{print $1}'`:0
    bongioc@ncp-cb-1:~$ echo $DISPLAY
    10.5.4.83:0
    bongioc@ncp-cb-1:~$ xterm
    No protocol specified
    xterm: Xt error: Can't open display: 10.5.4.83:0
    bongioc@ncp-cb-1:~$
    

    None of this works. But, if I use putty and select X11 forwarding, it just works.

    I would prefer not use putty. Can someone explain how I can get mingw (preferred) or cygwin to actually forward X11 correctly? I am using xming for my xserver