LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   X forwarding though SSH not working: $DISPLAY not set (http://www.linuxquestions.org/questions/linux-networking-3/x-forwarding-though-ssh-not-working-%24display-not-set-879365/)

vlsd 05-07-2011 01:34 PM

X forwarding though SSH not working: $DISPLAY not set
 
I am trying to redirect my display from a debian box that I ssh into to my laptop. I connect using
Code:

$ssh -vv -XC remote.host
and in the debug messages all I get about X is this
Code:

debug1: Requesting X11 forwarding with authentication spoofing.
Once I'm connected, X forwarding does not work. For example, when I try and start, say, xcalc, I get
Code:

$xcalc &
Error: Can't open display:

It seems that the problem is the $DISPLAY variable is not set on the remote machine (echo $DISPLAY doesn't return anything), but from what I read, sshd is responsible for setting this variable, as long as "X11Forwarding yes" is uncommented in the /etc/ssh/sshd_config file (which I made sure is true).

Is there any other reason why sshd won't open a display on the remote host?

pingu 05-07-2011 01:58 PM

Try with "Y" instead of "X" - $ssh -vv -YC remote.host

vlsd 05-07-2011 05:51 PM

Quote:

Originally Posted by pingu (Post 4349415)
Try with "Y" instead of "X" - $ssh -vv -YC remote.host

Already did. It makes no difference.

CodeKrash 05-07-2011 06:33 PM

Time to break out a tutorial and re create a headless O/S for use the way you want. I found that a properly configured box this way, is clever and valuable.

vlsd 05-07-2011 07:39 PM

I had missed what might be a key debug message when trying to connect. Here it is:
Code:

debug2: x11_get_proto: /usr/X11R6/bin/xauth  list unix:0.0 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.

Note that xauth is NOT in that location (/usr/X11R6/bin) on either local or remote machine.

Also, I checked the debug output on the server side, by running '/usr/bin/sshd -ddd' and then connecting to it. Here I found something interesting:
Code:

...
debug1: server_input_channel_req: channel 0 request x11-req reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req x11-req
debug3: sock_set_v6only: set socket 9 IPV6_V6ONLY
debug2: bind port 6010: Cannot assign requested address
debug3: sock_set_v6only: set socket 9 IPV6_V6ONLY
debug2: bind port 6011: Cannot assign requested address
...
debug2: bind port 6999: Cannot assign requested address
Failed to allocate internet-domain X11 display socket.
debug1: x11_create_display_inet failed.
...

This seems to have to do with IPV6, but I have no idea why. Can anyone help further?

vlsd 05-07-2011 08:00 PM

OK, I solved it. Using that last debug message and Google I came over these two posts

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595014
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=422327

Apparently, disabling ipv6 in any way messes with X forwarding in ssh, it turns out it's an openssh issue. The posts suggest two workarounds:
1. add '-4' to the options passed to sshd in /etc/default/ssh
2. add 'AddressFamily inet' in /etc/ssh/sshd_config

I did the second one and it worked. Phew! This one was a toughy.

Ture 07-13-2012 08:36 AM

Same problem in RedHat 6.3 after disabling ipv6.
Added "AddressFamily inet" (without quotes) to /etc/ssh/sshd_config and Eureka :)

Thanks a lot!!!

dweezil36 03-10-2013 07:37 AM

Same problem on avlinux 6.0, same fix
thanx a lot :)

Mektub 12-09-2013 06:40 AM

Quote:

Originally Posted by vlsd (Post 4349612)
OK, I solved it. Using that last debug message and Google I came over these two posts

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595014
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=422327

Apparently, disabling ipv6 in any way messes with X forwarding in ssh, it turns out it's an openssh issue. The posts suggest two workarounds:
1. add '-4' to the options passed to sshd in /etc/default/ssh
2. add 'AddressFamily inet' in /etc/ssh/sshd_config

I did the second one and it worked. Phew! This one was a toughy.

Same problem in Debian jessie.

Thanks a lot.

Mektub


All times are GMT -5. The time now is 02:27 AM.