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

Re: User cannot start Xapps as root from terminal



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. 

--- Johan Ehnberg <johan@ehnberg.net> wrote:
> Hi!
> I wonder if anyone knows a solution to my problem:
> I have to run a program (openoffice install) as root
> under Xterm (logged 
> in as normal user). After doing 'su -' in the
> terminal all X programs 
> result in an error:
> 
> cannot connect to X server
> 
> Any help appreciated!
> 
> Cheers, Johan
> 
> -- 
> Johan Ehnberg
> johan@ehnberg.net
> "Windows? No... I don't think so."
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to
> debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



Reply to: