LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   X11 forwarding failed (https://www.linuxquestions.org/questions/linux-newbie-8/x11-forwarding-failed-872212/)

doublealice 03-31-2011 01:44 PM

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!

stress_junkie 03-31-2011 02:11 PM

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.

doublealice 03-31-2011 02:43 PM

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?

themanwhowas 03-31-2011 06:39 PM

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

chrism01 03-31-2011 07:47 PM

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?

theNbomr 03-31-2011 08:22 PM

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.

doublealice 04-01-2011 11:29 AM

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!

theNbomr 04-01-2011 01:21 PM

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.

doublealice 04-04-2011 10:18 AM

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!

JamesNT 04-22-2011 09:21 PM

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

theNbomr 04-22-2011 10:41 PM

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.

chuck_theobald 06-06-2012 11:59 AM

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.

karl0sfandang0 09-09-2014 01:12 AM

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.

ashepster 11-08-2018 10:54 AM

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



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