Sign up ×
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.

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


and the result is


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
Have you tried -Y instead of -X? – Flup Jul 22 '13 at 11:35
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

2 Answers 2

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=''

People seem to have this problem commonly when ssh'ing from Mac OS X.

share|improve this answer
Using XQuartz I was unable to use the -Y flag. "X11 connection rejected because of wrong authentication." – Erik Feb 21 '14 at 4:01
even after trying your other suggestions, I'm unable to open a display. – Erik Feb 21 '14 at 4:04

this worked for me:


X11UseLocalhost yes


X11UseLocalhost no
share|improve this answer

Your Answer


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.