SUMMARY: xhost problem when using emacs as su

From: Edward J. Hartnett (
Date: Mon Aug 03 1992 - 15:57:17 CDT


Here's my original posting:

> I'm running Openwin 2 on a Sun IPC (running 4.1.1), and I use emacs,
> with no problems. But when I su to root, and try to use emacs, it gives me
> grief. I don't know diddly about x windows. Can anyone help?
> Script started on Fri Jul 31 15:08:17 1992
> [khonshu ! ]% xhost
> access control enabled (only the following hosts are allowed)
> [khonshu ! ]% su
> Password:
> [khonshu:/home/khonshu/ejh ! ]# xhost
> Xlib: connection to "localhost:0.0" refused by server
> Xlib: Client is not authorized to connect to server
> xhost: unable to open display "localhost:0.0"
> [khonshu:/home/khonshu/ejh ! ]# emacs
> Xlib: connection to "localhost:0.0" refused by server
> Xlib: Client is not authorized to connect to server
> X server not responding. Check your DISPLAY environment variable.

I got many responses, thank you all. Here's how they worked out.

Many people suggested that before suing I try either:
        xhost +
        xhost +khonshu
        xhost +localhost

All of these worked, but, as these people pointed out, it leaves a
big security hole (the first leaves the biggest hole - as I understood
Nick Ruprecht's answer, doing that would allow any machine to snoop at
my keyboard, and get my root password. He indicated that programs to
do just that have been posted on the net.

Several others suggested that I setenv XAUTHORITY in my /.cshrc to
point to my home directory's .Xauthority file. This is what I have done.
Thanks to Andreas Luik, Sami-Jaakko Tikka,,
and Casper Dik.

Several people suggested that I look at the man pages for X, Xauthority, and
xhost, but for some reason I don't have these man pages on my system.

Bob Smith suggested I try xhost +root@, which he said would work if my server
was built with secure RPC defined (whatever that means). Apperently it was
not, because I got "bad hostname" when I tried this.

Brett Lymn suggested that I setenv DISPLAY after suing, which was a clever
solution, I thought, that got emacs to use the current window, instead of
opening it's own.

Ravi Boddapati suggested that after xhost+ and suing, I setenv DISPLAY khonshu,
this did not work, nor did it work when I tried setenv DISPLAY localhost:0.0
which is the default anyway. Apperently the setting of DISPLAY was not the

The second part of my question was how do I set things up to be able to
log out of root using ^D without getting a message that I should use exit
instead. Many people sent me the correct answer there, which is of course
to put the following in /.cshrc
        unset ignoreeof

But one thing puzzles me. Most people suggested that I look for (and comment
out) a line like: set ignoreeof, but there was no such line in /.cshrc or
/.login, so where else would it be?

Thanks again to all who helped. I have the email addresses of them all, in case
anyone wants to contact them.

                                Ed Hartnett

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:46 CDT