Re: emacs: Cannot connect to X server :0.0

From: Thomas D. Shepard (ImaSpammer_at_spam.sux)
Date: 07/31/04


Date: Fri, 30 Jul 2004 16:56:16 -0700

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

-- 
Thomas D. Shepard
Sorry, you can't email me.
(Email address is fake.)


Relevant Pages

  • Re: emacs: Cannot connect to X server :0.0
    ... I am logged in and need to run emacs as root to ... But you may want to issue a more restrictive xhost command, ... > make sure the X-Windows session was started under your username. ... >> I can just open files with emacs one hour ago without doing anything. ...
    (comp.os.linux)
  • Re: Tam Lin podcast site
    ... The first screen is always a session on ... I sometimes use the Emacs scratch buffer for that, ... "Incompatibility Package" on TOPS-20 (there was the official ...
    (rec.arts.sf.fandom)
  • Re: I found an even easier way to crash CMUCL 19c/19f on FreeBSD 7.1
    ... I seem to remember you were using an UNIX shell account. ... new e-mail to your own computer at the start of the session, ... The version of Emacs here is horribly broken. ... Hmm, when I upload new versions of my source files, I keep around ...
    (comp.lang.lisp)
  • Re: I found an even easier way to crash CMUCL 19c/19f on FreeBSD 7.1
    ... I seem to remember you were using an UNIX shell account. ... new e-mail to your own computer at the start of the session, ... The version of Emacs here is horribly broken. ... Hmm, when I upload new versions of my source files, I keep around ...
    (comp.lang.lisp)
  • Re: Tam Lin podcast site
    ... you want to return to a suspended edit job and paste something you cut ... The first screen is always a session on ... As far as Emacs knows, ... "Incompatibility Package" on TOPS-20 (there was the official ...
    (rec.arts.sf.fandom)