Super User is a question and answer site for computer enthusiasts and power users. 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 want to ssh to remote servers, both running CentOS with X11Forwarding enabled.

However the X application cannot run properly on one of them - on host B it works fine. But on host A I get the error "couldn't connect to display", each time I launch X application.

After checking the DISPLAY environment variable on host A which I think is related to X window, I found its value localhost:10.0. Following the tips here, I change DISPLAY=0:10.0 and it works. However, DISPLAY on host B is still localhost:10.0 and works fine.

My question is, what does the value in DISPLAY represent? What is the difference between localhost:10.0 and 0:10.0?

It is said that localhost identifies a host name. Then which host does it identify, the server(host A/B) on which my X application is running or my local client where I want the X window to display?

Any hints or pointers to documentation would be appreciated.

share|improve this question
up vote 4 down vote accepted

Part of the answer can actually be found here:

DISPLAY variable is basically 3 components:


As far as localhost aka vs. aka 0 is concerned you can take a look at this post:

Which explains the difference.

In your particular case and localhost:10.0 would have the same effect but basically mean:

  1. connect on any interface that have the display 10 set up
  2. connect on lo0 to the listener of display 10.

Practically there would be no difference since in the first case the scan of all interfaces would start with lo0, which normally is the first interface in the list.

share|improve this answer
Thanks at first. I find the real problem follow your tips. The real problem is that localhost is binded specific ip like that. I don't want to expose my real configure.) on host A. It also works when export DISPLAY= Does X forwarding only works on loopback interface? – Summer_More_More_Tea Dec 20 '11 at 14:04
localhost is a special name that binds to a loopback interface (lo0) on Linux it should never be bound to a real IP address. You can actually check the binding by running sudo netstat -apn | grep 6010 your SSH should be listening on that port for the display connection. As far as I can tell it's only. – Karlson Dec 20 '11 at 14:50
Problem solved. Thank you very much. – Summer_More_More_Tea Dec 21 '11 at 1:58

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.