connection to ":0.0" refused by server

Matt Zimmerman mdz@csh.rit.edu
Wed, 14 Jul 1999 18:37:24 -0400


On Wed, Jul 14, 1999 at 08:07:02AM -0700, Chris Waters wrote:
> Alan DuBoff <maestro@SoftOrchestra.com> writes:
> > When I su to another user on the system (inside a terminal), I get the
> > following error when trying to run an X app:
>
> > Xlib: connection to ":0.0" refused by server
>
> > I can do this on Red Hat, but not Debian.
>
> Really?  Solaris, HP/UX, and every other Unix I've ever used will do
> the same thing as Debian here.  I'm a bit appalled to hear of a system
> that doesn't refuse the connection.  No professional quality system
> would do such a thing.  Obviously, RH doesn't fall into that category.

What may be happening on the Red Hat system is that 'su' isn't setting
the HOME environment variable, leaving it set to the original user's
home directory.  Solaris 2.x exhibits the same behavior.  When this
happens, X applications will find the user's ~/.Xauthority file and be
able to connect to the server.  Such variants of 'su' will only modify
the environment when given the '-' pseudo-argument.

$ echo $HOME
/home/mdz
$ su
Password: 
# echo $HOME
/home/mdz
# exit
$ su -
Password: 
Sun Microsystems Inc.   SunOS 5.6       Generic August 1997
# echo $HOME
/root
# exit
$ exit

-- 
 - Matt