[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Xlib: connection to ":0.0" refused by server ???



On Thu, 28 Nov 2002 14:00:56 +0100
Tobias Kraus <tobias.kraus@stud.tu-muenchen.de> wrote:

> > daves debian wrote:
> > > When i am logged in as a user, I want to execute an X program as
> > > root, I type
> > > su
> > > <password>
> >
> > ...
> >
> > > The X library has been refused by the X server, because root is
> > > not autherised to connect to the server ??
> >
> > ...
> >
> >    only authorized user can connect to X server, just because you
> >    are
> > root doesn't mean you can connect to X server on given machine (just
> > like you cannot connect to other services - e.g. you'd still need
> > password for database, ...)
> >
> >    you have few options:
> >
> >    1) xhost (see man xhost), don't do that though!
> >
> >    2) as root run: xauth merge ~userThatRunsX/.Xauthority
> >
> >    option 2 will give you access to X server without compromising
> > security (while it's running, if you restart X you have to run xauth
> > again)
> >
> > 	erik
> 
> alternatively you can do this in the root home directory (/root):
> 
> ln -s ~userThatRunsX/.Xauthority .
> 
> This will work as long as you don't log in in X as root. Then, the
> .Xauthority file will be overwritten.
> 
> Tobias
> 

On my system, when I'm in X, my XAUTHORITY environment variable is set
to something like

XAUTHORITY=/tmp/.gdmXfTqzn

This is being done because I use gdm. Is there any way to automatically
determine what that's going to be or a way to link to XAUTHORITY when it
changes every login? I'm trying to use the X display in a procmail
recipe when I'm logged in but since the XAUTHORITY variable keeps
changing I can't set it arbitrarily in the .procmailrc environment
lines.

For the user who started this thread -- if you have the same problem,
you can set up sudo for the user that needs root access. It works
without having to play with xauth.

G

-- 
Configure your Email to send TEXT ONLY -- See the following page:
http://expita.com/nomime.html

gvl2 (Gerald)
AirBall the Rolling Basket Case (1969 Standard Beetle)
LifeSaver (1974 Bay Window Bus)
http://www.phorce1.com



Reply to: