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

Re: Magic cookies and running programs under X as root



To quote "Christopher R. Barry" <christopher_r_barry@yahoo.com>,
# I guess tonight I finally want to get around to figuring out how to
stop this
# from happening. What do I do so I can run programs as root?

There are two solutions, that I know of. 'xhost' changes the access
controls for the $DISPLAY under which it's run.

'xhost +' removes all protection - anyone can access your display.
'xhost +localhost' lets only local users(but any of those) access your
display.

You're probably looking for the second option. 'man xhost' for more
information.

The second way I know how to do it is to set $XAUTHORITY to the
user's(the one who started the X session) ~/.Xauthority. So, my login is
david, I start an X session, 'su' to root, and then:

export XAUTHORITY=/home/david/.Xauthority

If that .Xauthority file is readable by the user who wants to open a
connection(in your case, it's root, so you know it's readable), then X
will accept the connection.

David Barclay Harris, Clan Barclay
    Aut agere, aut mori. (Either action, or death.)



Reply to: