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

Re: Logging on to X as root?

David Krider wrote:
> I'm still curious, though, about the reason that the other way seemingly 
> *can't* work. Why won't a simple `su -' to root let me run an X 
> application, even though I export a DISPLAY variable and `xhost +' on 
> the user side? I want to understand what Debian is doing here.

This has nothing to do with Debian.  That is just basic X11.  What you
are seeing is xauthority.  It is looking for an xauth magic cookie.
This is stored in ~/.Xauthority.

For example, ~/.Xauthority is $HOME/.Xauthority and for a user 'bob'
that would be /home/bob/.Xauthority.  But if I 'su -' to get to root
and root's home environment then that file is still ~/.Xauthority only
now that is /root/.Xauthority, a completely different file with a
completely different set of cookies, none of which have been allowed
access to your display.

This is why 'su -m' and 'sudo' all work.  They preserver $HOME and the
same cookie file.


Attachment: pgpv6oZ63RXO5.pgp
Description: PGP signature

Reply to: