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

Re: Magic cookies and running programs under X as root



on Sun, Jan 28, 2001 at 02:12:44AM -0800, Terry Carney (tcarney@selterra.com) wrote:
> On Sat, 27 Jan 2001, Christopher R. Barry wrote:
> 
> >   Xlib: connection to ":0.0" refused by server
> >   Xlib: Client is not authorized to connect to Server
> >   Error: Can't open display: :0.0
> > 
> > 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?
> 
> The following works for me. All on one line in case of wordwrap.
> 
> XAUTHORITY=/home/username/.Xauthority;DISPLAY=:0.0;export XAUTHORITY DISPLAY

*Don't* do this.

You're now allowing access to root's X display via an unprivileged
user's file.  If that file is compromised, root's X access is
compromised.  This includes changing the value of the cookie in the
file.

Better to merge against a user's file.  This allows you to match the
present state of the file, but prevent future values from being applied
to root's X authorization keys.  Puts root in stronger control.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgpKFcZmnbFNX.pgp
Description: PGP signature


Reply to: