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

Re: Gtk error only when root! (??)

Lo, on Tuesday, January 22, Mark Ferlatte did write:

> On Tue, Jan 22, 2002 at 01:23:16PM -0800, Camilux wrote (1.00):
> > if i am not root, i can for example open gdmconfig, but it says i 
> > need to be root to change things; so i su - myself up to root, but 
> > when i type gdmconfig, i get this error:
> > 
> > Gtk Error: Can't Open display
> <snip>
> > whats wrong here?
> X uses security mechanisms to prevent other users on the same machine
> from using your display.  The easiest way to fix this is to put the
> following in your .bashrc (if you use bash):
> export XAUTHORITY=$HOME/.Xauthority
> then log out, log back in.
> This will let you run X apps via su or sudo.

Except that when you do `su -', as the OP noted, not all of your
environment settings propagate into the root shell.  Instead, after you
su, do the following:
    xauth merge ~user/.Xauthority
where `user' is the name of the user from which you su'd.  (If, for
whatever reason, user's X authority file is in a different location, as
with an ssh connection, substitute the correct filename in its place.)


Reply to: