emacs: Cannot connect to X server :0.0.

Posted on 2004-09-07
Last Modified: 2013-12-27
I am using Red hat 9 which has been newly installed.I am having problem evoking "emacs" as the user.I tried through root and it worked fine.
 Whenever I start it as the user it gives me the following message :-

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
emacs: Cannot connect to X server :0.0.
Check the DISPLAY environment variable or use `-d'.
Also use the `xhost' program to verify that it is set to permit
connections from your machine.
Any help in this regards will be appreciated
Question by:bibinbhanu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 40

Expert Comment

ID: 12003663
Is the user that is trying to start emacs the logged in user, or have you logged in as one user and 'su'd to another? The logged in user should be able to start emacs.

Author Comment

ID: 12004616
i have logged in as the user , i.e. the user that is trying to start emacs is the logged in user.
LVL 20

Accepted Solution

Gns earned 125 total points
ID: 12004620
Yep. If you'd like all "local users" to be able to write to the X display, you could do "xhost + localhost" as the user who started the X session (root in all probability;-), then the user should have no problem:-).

-- Glenn
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 20

Expert Comment

ID: 12004626
Ah, semi-crossing posts.

Could you quote the output from

-- Glenn
LVL 20

Expert Comment

ID: 12004630
And could you also quote the content of /etc/hosts here? Might be that you've done something silly to the "loopback address":-)

-- Glenn

Author Comment

ID: 12013137
Thanks for the help Glenn, the emacs editor is working now.

Expert Comment

ID: 12639021
I have the same problem
But it will work if I use from the start menu: "Run Command"
You don't have to be root but sometimes it helps, so do the following if you have to use root:
When the windows appears click "Options" and enter the user: "root" and his "password"
You have to give the full path to the command

Hope it will partially help

LVL 20

Expert Comment

ID: 12648720
Has top do with the credentials you have michelandre,,, Since when you "Run..." you always do that as the user that started X, it'll always work like that;-).
The xhost + ... bit would help, but should only be performed in situations where you are comfortable with the local security/users;-);-)

-- Glenn

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question