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

Bryn Reeves hagbard at nildram.co.uk
Thu Mar 25 14:55:33 UTC 2004


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.

Cheers,

Bryn.







More information about the Swlug mailing list