Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm able to login to sever using

ssh -X Hostip

but when i run the command xclock it give me this error

Error: Can't open display: localhost:11.0

I check my Display value using

echo $DISPLAY

and the result is

localhost:11.0

And X11 forwarding is set to YES in sshd_config file

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Any advice what I'm missing here?

share|improve this question
1  
Have you tried -Y instead of -X? – Flup Jul 22 '13 at 11:35
1  
Also, make sure you understand the implications of using -Y instead of -X. You may also want to look at xhost. – Michael Kjörling Jul 22 '13 at 11:36

Use -Y. From the man page on ssh:

-Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.

If you're still having problems though, you can try setting $DISPLAY to your local box's IP:

$ export DISPLAY='<ip_address>:11.0'

It may work to set it as

$ export DISPLAY='127.0.0.1:11.0'

People seem to have this problem commonly when ssh'ing from Mac OS X. You may also want to set

X11UseLocalhost no

in this case as well.

share|improve this answer
1  
Using XQuartz I was unable to use the -Y flag. "X11 connection rejected because of wrong authentication." – Erik Feb 21 '14 at 4:01
2  
even after trying your other suggestions, I'm unable to open a display. – Erik Feb 21 '14 at 4:04
    
Neither one of these worked for me either. I needed to install XWindow support in my Centos 7 server (minimal) with: yum groupinstall "X Window System" -y – Mark Edington Dec 29 '15 at 16:19

this worked for me:

Change

X11UseLocalhost yes

to

X11UseLocalhost no
share|improve this answer
    
Thanks, Don. that worked for me also. I gave you an upvote. I believe the problem interfering with the default was that the specific machine is xhost enabled. – L. D. James Dec 22 '15 at 0:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.