LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-07-2011, 02:34 PM   #1
vlsd
LQ Newbie
 
Registered: Aug 2009
Location: Chicago
Distribution: Debian Testing, Arch, Ubuntu 12.04
Posts: 12

Rep: Reputation: 1
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?
 
Old 05-07-2011, 02:58 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Try with "Y" instead of "X" - $ssh -vv -YC remote.host
 
Old 05-07-2011, 06:51 PM   #3
vlsd
LQ Newbie
 
Registered: Aug 2009
Location: Chicago
Distribution: Debian Testing, Arch, Ubuntu 12.04
Posts: 12

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by pingu View Post
Try with "Y" instead of "X" - $ssh -vv -YC remote.host
Already did. It makes no difference.
 
Old 05-07-2011, 07:33 PM   #4
CodeKrash
LQ Newbie
 
Registered: May 2011
Posts: 21

Rep: Reputation: 1
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.
 
Old 05-07-2011, 08:39 PM   #5
vlsd
LQ Newbie
 
Registered: Aug 2009
Location: Chicago
Distribution: Debian Testing, Arch, Ubuntu 12.04
Posts: 12

Original Poster
Rep: Reputation: 1
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?

Last edited by vlsd; 05-07-2011 at 08:51 PM. Reason: extra debug output
 
Old 05-07-2011, 09:00 PM   #6
vlsd
LQ Newbie
 
Registered: Aug 2009
Location: Chicago
Distribution: Debian Testing, Arch, Ubuntu 12.04
Posts: 12

Original Poster
Rep: Reputation: 1
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.
 
1 members found this post helpful.
Old 07-13-2012, 09:36 AM   #7
Ture
LQ Newbie
 
Registered: Jul 2012
Posts: 1

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

Thanks a lot!!!
 
Old 03-10-2013, 08:37 AM   #8
dweezil36
LQ Newbie
 
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
Same problem on avlinux 6.0, same fix
thanx a lot
 
Old 12-09-2013, 07:40 AM   #9
Mektub
LQ Newbie
 
Registered: Jan 2004
Location: Lisbon, Portugal
Distribution: Arch
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by vlsd View Post
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
 
  


Reply

Tags
debian, ipv6, openssh


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
X-forwarding in slack over SSH - unable to open display Old_Fogie Slackware 9 08-04-2012 04:01 PM
The difference in settings: console from desktop & ssh as DISPLAY not set when ssh in wikapuki Linux - Newbie 10 07-02-2010 10:44 AM
[SOLVED] X11 forwarding problem over ssh. Where DISPLAY is set? kaz2100 Linux - Software 3 09-27-2009 06:32 AM
Can't get X forwarding working with SSH. pdeman2 Fedora 21 06-18-2006 03:38 PM
XDMCP display forwarding not working antaydos Linux - Networking 17 06-05-2003 04:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration