LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-31-2011, 01:44 PM   #1
doublealice
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Rep: Reputation: 0
X11 forwarding failed


I had found many posts which talked about this problem. I also had ever tried all methods they mentioned, but my problem is still there. I write it down here and hope to get your help. Thank you!

I am using a MAC OS X 10.6 ssh a remote redhat server. I hope to see X of redhat on my own MAC. Below is what I've done:

'MAC_ip' stands for my mac; 'redhat_ip' stands for redhat server.

1) ssh to redhat server
2) change to root
3) type command: DISPLAY=MAC_ip:0.0
4) type command: export

5) Back to MAC
6) change to root
7) type command: xhost +Redhat_ip
8) vim /etc/ssh_config, add X11Forwarding yes

9) Back to redhat, type: xclock
I got below message:
Error: Can't open display: MAC_ip:0.0

I also tried some methods to login as others suggested:
Code:
% ssh -X user@redhat_ip
user@redhat_ip's password: 
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Thu Mar 31 08:59:46 2011 from MAC_ip
Somebody also suggested to use 'ssh -Y', although I don't quite understand it, I also tried.

Code:
% DISPLAY=MAC_ip:0.0 ssh -Y user@redhat_ip xclock
user@redhat_ip's password: 
connect MAC_ip port 6000: Connection refused
Error: Can't open display: localhost:10.0
This is really bother. Please advice. Thank you!

Last edited by doublealice; 03-31-2011 at 01:46 PM.
 
Old 03-31-2011, 02:11 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
On the Red Hat machine before you use ssh enter the following command.
Code:
xhost +inet:MAC_ip
Also make sure that your firewall on the Red Hat machine isn't blocking the connection request from the Macintosh machine.

Last edited by stress_junkie; 03-31-2011 at 02:12 PM.
 
Old 03-31-2011, 02:43 PM   #3
doublealice
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
I tried: xhost +inet:MAC_ip, but it said:

xhost: unable to open display ""

The redhad server is a brand new server. I can use ssh login it. Does it mean the firewall on that server approves my connection?
 
Old 03-31-2011, 06:39 PM   #4
themanwhowas
Member
 
Registered: Nov 2005
Distribution: CentOS 5, Fedora 23
Posts: 218

Rep: Reputation: 29
It's been a while but I'm sure that X11 forwarding has to be enabled in the redhat machine.

/etc/ssh2/sshd2_config

AllowX11Forwarding yes
 
Old 03-31-2011, 07:47 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This may seem like a dumb qn, but many servers don't have X-win installed. Are you sure the RH server does have X-Win installed?
 
Old 03-31-2011, 08:22 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
doublealice, you are yet another among the legions of people confused about the X11 client-server model. Don't be insulted, it fools almost everyone as they first approach it.
Quote:
I hope to see X of redhat on my own MAC
This will never happen (except perhaps using a remote desktop tool). What you probably mean is that you want the applications running on your remote Redhat host to use the X server running on your local Mac.
To do so is relatively easy. First, do as themanwhowas suggests, and make sure X11 forwarding is enabled on the Redhat host. Next, from the commandline on your Mac, with X11 running on the Mac:
Code:
ssh -X someuser@your.redhat.host
#
# password exchange to log in....
#
xterm&
If an xterm console appears on your local Mac, then X forwarding is working. The xterm is running on the Redhat host, but is displaying its output and receiving keyboard and pointer input from the X server running on your Mac. What's more, X11 is being securely tunneled through the ssh session, and no compromise of the server is required by using the likes of xhost.

As chrism01 correctly points out, there may be no X11 server on the Redhat server. This is absolutely no obstacle, and is a very common model for management of headless file and database servers.

--- rod.

Last edited by theNbomr; 03-31-2011 at 08:29 PM.
 
Old 04-01-2011, 11:29 AM   #7
doublealice
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Hi Rod and all,

Thank you so much for your help. I tried what you've suggested. It works! I am so happy for that. But there is still some warnings.

What I've done as below:

My redhat is a new server running redhat enterprise server 6. There isn't ssh2_config file. So like what I did yesterday, I uncommented a line contains 'X11Forwarding yes' in sshd_conf.

Back to Mac, in terminal, type 'xterm&'. In a X terminal, using ssh login to redhad, as Rod suggested. I can login but got two warnings:

Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.

Although I got those warnings, I still typed xterm& and opened a new xterm which comes from redhat. Then try 'xclock&'. It displayed!! So great!

Now, I have an other question. I opened 'firefox' from xterm. Firefox was also booted up, but the letters on menu and top bar were blurred. And the warnings I got were:

Xlib: extension "RANDR" missing on display "localhost:10.0".
Xlib: extension "RANDR" missing on display "localhost:10.0".
Xlib: extension "RANDR" missing on display "localhost:10.0".

Have you ever met such problem?

This is a new problem. But I already feel so happy that you help me solved a problem which had bothered me for more than three days! Thanks all your help!

Last edited by doublealice; 04-01-2011 at 11:31 AM.
 
Old 04-01-2011, 01:21 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Did you undo all of the xhost/xauth configuration that you originally tried? My interpretation of the error/warning messages is that they originate there.
Code:
Xlib: extension "RANDR" missing on display "localhost:10.0".
These messages say that the application expects certain optional functionality in the X server, and has failed to find it. The RandR extension allows the client application to query the server about some of its hardware capabilities, and is not universally supported. Evidently, there is also some issue with support combined with Xinerama. I don't know of any sure-fire remedy, especially since there is a driver-specific aspect to this matter. Does the same version of firefox running on the local host exhibit the same complaint? Firefox is a bit of a rascal when run on a remote host, as it will try to piggy-back onto an existing instance that is running on the X server host, unless started with the -no-remote option. Perhaps there is some interplay there.

--- rod.
 
Old 04-04-2011, 10:18 AM   #9
doublealice
LQ Newbie
 
Registered: Mar 2011
Posts: 17

Original Poster
Rep: Reputation: 0
Rod, I am new to a linux server. Thank you so much for explaining the problem to me. The reason I started up the firefox from the remote server was I needed to check if apache server worked on localhost well or not. Probably it is not a good way to do so. Anyway, I've learned a lot from you and may keep asking questions in the future. Thanks!
 
Old 04-22-2011, 09:21 PM   #10
JamesNT
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
X running under OSX

I am running Ubuntu 10.04
Using "New Remote Connection" under terminal I add my target hostname and then type

ssh -2 -X username@hostname

Enter my password

xclock etc all work now, but importantly when I type in the terminal

gnome-session

Up pops an Ubuntu Desktop on my iMAC.
But whilst it works there are still a torrent of RANDR errors in the terminal. Any suggestions on what I need to suppress these.

jnt
 
Old 04-22-2011, 10:41 PM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Is the RandR extension builtinto the iMAC X server? If not, then the messages are likely to keep appearing. It may also be (speculation only here) that you are trying to get the X server to do something which is in conflict with a setting imposed by the iMAC desktop. Do those errors happen when you run any old X application, or only when you try to run a desktop on another desktop?

--- rod.
 
Old 06-06-2012, 11:59 AM   #12
chuck_theobald
LQ Newbie
 
Registered: Sep 2005
Location: Eugene, OR, US
Posts: 1

Rep: Reputation: 0
RHEL does not automatically come with xorg-x11-xauth installed. This must be installed for X11 forwarding to work:
yum install xorg-x11-xauth
Discovered this using the -v option to ssh, making it verbose.

Last edited by chuck_theobald; 06-06-2012 at 12:03 PM.
 
Old 09-09-2014, 01:12 AM   #13
karl0sfandang0
LQ Newbie
 
Registered: Sep 2014
Posts: 1

Rep: Reputation: Disabled
Worked!

Thank you chuck_theobald. The missing package on RHEL was what fixed this for me. I realize this thread is older, but for anyone else out there trying to tunnel X through multiple hops and hissing "Cannot open display" on a RHEL Client 2 or 3 hops away it's easy to get bogged down in the intricacies of SSH forwarding, when actually, it might just be this missing package. After I'd added the xorg-x11-xauth package I was able to simply ssh -Y <hop1>, then ssh -Y <hop2> and run the app, with the display coming back to my laptop perfectly.
 
Old 11-08-2018, 10:54 AM   #14
ashepster
LQ Newbie
 
Registered: Nov 2018
Posts: 1

Rep: Reputation: Disabled
Warning: untrusted X11 forwarding setup failed: xauth key data not generated

I know this is an old thread, but it showed up when I had this same problem.

Environment: XQuartz 2.7.11, macOS 10.4 Mojave.

Error: ssh -x hostname produces Warning: untrusted X11 forwarding setup failed: xauth key data not generated

Solution: ssh is looking for xauth in /usr/X11R6/bin and on macOS with XQuartz it is in /opt/X11/bin. Edit ~/.ssh/config to define the correct XAuthLocation and X11 forwarding now works.

Code:
Host *
    XAuthLocation /opt/X11/bin/xauth
 
  


Reply



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
X11 Forwarding Oxagast Linux - Software 1 09-02-2008 03:14 AM
X11 Forwarding BlueTornJacket Linux - Server 11 03-12-2007 05:00 PM
X11 forwarding paul_mat Linux - Newbie 3 12-12-2004 06:30 PM
X11 forwarding JanDeMan Mandriva 1 04-17-2004 09:02 PM
Need Help with X11 forwarding phatboyz Linux - General 3 04-16-2004 03:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:11 PM.

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