LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-30-2014, 11:26 PM   #1
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Rep: Reputation: Disabled
X11 forwarding request failed on channel 0


Hello,
I have RHEL 6.3 container. I am trying to run xclock from MobaXterm and it is not successful. At the time login itself, it give me error, which I mentioned in subject line
Code:
[465376.L9701067] ➤ ssh -X root@linux_123
X11 forwarding request failed on channel 0
Last login: Wed Apr 30 20:16:11 2014 from 10.24.46.23
[root@linux_123 ~]# xclock
Error: Can't open display:
[root@linux_123 ~]# echo $DISPLAY

[root@linux_123 ~]# cat /etc/ssh/sshd_config | grep X11 | grep -v "#"
X11Forwarding yes
X11UseLocalhost no
[root@linux_123 ~]#
I reloaded ssh daemon also, still no luck.
 
Old 05-01-2014, 09:09 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
the "X11UseLocalhost" should be yes.

This will prevent remote attacks to the port over the network, and limit attacks to users logged in on linux_123.

And did you restart the sshd service after changing the configuration file to enable X11Forwarding ?
 
Old 05-01-2014, 12:45 PM   #3
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
I have changed it, still no luck
Quote:
[root@linux_123 ~]# cat /etc/ssh/sshd_config | grep X11 | grep -v "#"
X11Forwarding yes
X11UseLocalhost yes
[root@linux_123 ~]# service sshd stop
[root@linux_123 ~]# service sshd start
[root@linux_123 ~]# /etc/init.d/sshd reload
[root@linux_123 ~]# xclock
Error: Can't open display:
[root@linux_123 ~]# echo $DISPLAY

[root@linux_123 ~]#
I logged out and login back and still it is throwing same error

Last edited by abhisheks77; 05-01-2014 at 12:47 PM.
 
Old 05-01-2014, 01:42 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
First thing, DISPLAY variable is not set, so system can't decide where to open x-utility. Set it first.
Code:
localhost# setenv DISPLAY <hostname>:port_no
Second, on system linux_123 invoke following cmd:
Code:
linux_123# xhost +<hostname>
Note: Here hostname is machine, from where you're invoking ssh to linux_123 machine.
 
Old 05-01-2014, 02:24 PM   #5
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
Shivaa, This Linux container (parallels). I try to find, but it doesn't have xhost
Also, how should I know, what should be port_no ?
 
Old 05-01-2014, 03:04 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
The X server doesn't normally open the TCP port anyway. It is a security weakness because the access keys are passed without encryption.


did you restart the sshd service on linux_123?

Logging out of linux_123 does not restart the service.

Sorry, just saw that you had.

After restarting, make a ssh connection. It should forward the X protocol.

Last edited by jpollard; 05-01-2014 at 03:05 PM.
 
Old 05-01-2014, 03:13 PM   #7
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
Hi again jpollard, Yes, I restarted ssh and logged out and login back, but still it was same issue.
 
Old 05-01-2014, 04:37 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
That implies that sshd was compiled without port forwarding.
 
Old 05-01-2014, 04:54 PM   #9
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
But it says ENABLED in conf file
Quote:
~]# cat /etc/ssh/sshd_config | grep X11 | grep -v "#"
X11Forwarding yes
X11UseLocalhost yes
Do I need to recompile or can I test it by any way, if it is forwarding ?
 
Old 05-02-2014, 04:27 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
If you have a DISPLAY environment variable defined then it should be forwarding.

Of course, if you still have it being defined in the profile, you can't tell - it may be forwarding, but you are getting the wrong DISPLAY value with the wrong key - thus it would still fail.
 
Old 05-02-2014, 04:42 AM   #11
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
To me, it looks an issue of wrong DISPLAY setting. In simple words, your local machine don't know where to open/launch the x utility. However, try to set DISPLAY variable as (use port no. 0.0):
Code:
localhost# setenv DISPLAY linux_123:0.0

Last edited by shivaa; 05-02-2014 at 04:43 AM.
 
Old 05-02-2014, 11:30 AM   #12
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
It is not accepting proper display settings. I tried this. Am I missing something ?
Quote:
linux_123# export DISPLAY linux_123:0.0
-bash: export: `linux_123:0.0': not a valid identifier
linux_123# export DISPLAY 10.53.16.34:0.0
-bash: export: `10.53.16.34:0.0': not a valid identifier
linux_123# export DISPLAY=localhost:0.0
linux_123# echo $DISPLAY
localhost:0.0
linux_123# xclock
Error: Can't open display: localhost:0.0
[root@linux_123 ~]#
 
Old 05-02-2014, 01:07 PM   #13
abhisheks77
Member
 
Registered: Apr 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
I am able to fix it.
I created .Xauthority file manually. Apart from this, ssh daemon was not able to restart properly. When I did reload and restart, still few old processes were holding it. I killed all ssh processes and then it worked.
Thanks Shivaa and jpollard
 
  


Reply


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
[SOLVED] SSH: X11 forwarding request failed on channel 0 273 Linux - Software 24 04-07-2015 05:16 PM
[SOLVED] X11 forwarding failed doublealice Linux - Newbie 12 09-09-2014 02:12 AM
SCP exec request failed on channel 0 lost connection SalientAnimal Linux - General 2 02-01-2013 03:37 AM
[SOLVED] PTY allocation request failed on channel 0 sycamorex Slackware 1 01-30-2011 06:55 AM
PTY allocation request failed on channel 0 nice88 Linux - Server 4 12-14-2010 06:44 PM


All times are GMT -5. The time now is 10:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration