[SWLUG] How can I run X apps as root?

Mark Summerfield mark at trolltech.com
Thu Mar 25 16:44:36 UTC 2004


On Thursday 25 March 2004 14:55, Bryn Reeves wrote:
> On 11:22 Thu 25 Mar     , Mark Summerfield wrote:
> > Hi,
> >
> > Whenever I try to run gvim as root I get this:
> >
> > $ vi
> > Xlib: connection to ":0.0" refused by server
> > Xlib: Client is not authorized to connect to Server
> > E233: cannot open displayXlib: connection to ":0.0" refused by server
> > Xlib: Client is not authorized to connect to Server
> > Xlib: connection to ":0.0" refused by server
> > Xlib: Client is not authorized to connect to Server
> > Xlib: connection to ":0.0" refused by server
> > Xlib: Client is not authorized to connect to Server
> >
> > Is there some simple thing I can do to change this? (I'm using
> > Debian/stable with KDE.) If the answer is RTFM then which man page?
> >
> > Thanks.
> >
> > --
> > Mark.
>
> Hi Mark,
> This is the simple way which has worked for me.. I think there is
> probably a better way that I am unaware of, hopefuly someone on the
> list can advise.
>
> As root, you need to copy the .Xauthority file from the home directory
> of whatever user is running X into root's home. For example, I
> sometimes want root on one machine to display on my X desktop, where
> i'm logged in as 'bryn'. This is remote of course, but should also work
> for local.
>
> # scp bryn at desktop:./.Xauthority ~root/
>
> I think the same result can be achieved with the xhost command - the
> man page says that 'xhost +<user>' should authorise that user to
> connect to the X server. I've not used this method tho, and when I
> tried it seems not to work.

That worked like a charm! Thanks.

(I read the other replies too--thanks to all of you. I didn't want to
use sudo because when I su it is usually to do a few commands rather
than just one. I could have used ssh, but went for the easiest option:)

-- 
Mark.




More information about the Swlug mailing list