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

Re: User cannot start Xapps as root from terminal



On Tue, 2002-08-13 at 21:45, Larry Smith wrote:
> This explanation was posted to a similar question
> awhile back.  With the originator's blessing (I hope)
> I'll repost it.
> 
> 
> This is from a local LUG list:
> The safe way of doing this is to use xauth.  xauth
> will allow you to
> set a magic cookie on your root account such that your
> X server will
> recognize it as being eligible to access your X
> server. 
> First, as the non-root user who is running X type in
> an xterm:
> xauth list $DISPLAY
> which will output the xauth cookies associated with
> your current
> display.  It should look something like:
> debian/unix:0  MIT-MAGIC-COOKIE-1 
> f00004739672dece010d7e1faf01dca9
> ( note, the magic cookie has been changed to protect
> the innocent ). 
> Then in the xterm where you have used su to become
> root type:
> xauth add $DISPLAY . f00004739672dece010d7e1faf01dca9
> ( please note the big long number matches the one
> above ). 
> Now your root user can access your X server and
> display X apps.  Since
> the root user is caching the magic cookie in the
> .Xauthority file in
> roots homedir you will be able to display on this X
> server instance as
> root as long as it keeps running. 

Here is a suggestion from the xscreensaver FAQ which is a bit shorter:

xauth -f /home/<user>/.Xauthority nextract - $DISPLAY | xauth nmerge -

Which is still too cumbersome in my opinion, I just use 'su -p' for that
matter (albeit you don't get root's path that way).

Claudio



Reply to: