Subj : Re: emacs: Cannot connect to X server :0.0 To : comp.os.linux From : xproe Date : Mon Aug 02 2004 09:39 am "Thomas D. Shepard" wrote in message news:... > On Fri, 30 Jul 2004 11:27:08 -0700, wendy wrote: > > There is not enough information here to unambiguously resolve your > problem. But I'll try anyway. > > The most frequent case where I encounter this error is when I attempt to > start up emacs and am logged in as a user other than the user who owns the > display. For example, I am logged in and need to run emacs as root to > perform maintenance. So my session looks like this > > thomas[1] su - > password: ******** > root[1] emacs & > Xlib: connection to ":0.0" refused by server > root[2] xhost + > access control disabled, clients can connect from any host > root[3] emacs & > (now it works) > > Note that xhost + is a very insecure way to fix this problem. Since I am > behind a firewall that I personally configured and tested, it is ok for > me. But you may want to issue a more restrictive xhost command, to allow > connections from localhost. Check the xhost man page. > > Unless you have some special reason like the preceding, you should just > make sure the X-Windows session was started under your username. > > There are lots of other things that can cause this too. > > X probably logs messages to a file called ".xsession-errors" in your home > directory (the home directory of whoever is really running the x session). > That would be a good place to look for more clues on what is wrong. > > > I have a newbie problem on emacs also, in fact all the X window program. > > > > When I want to use emacs to edit the existing file, I got the following error: > > ----------------------------------------------- > > 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. > > ----------------------------------------------- > > I can just open files with emacs one hour ago without doing anything. > > Can someone help me with this? > > > > Thanks > > Wendy Thanks, I solved the problem by removing lock directory '/u03/wli1/.gconf/%gconf-xml-backed.lock', which was suggested in ..xsession-error file. Thanks again! Wendy .