XFree86 4.2 & KDE3 - starting a x app from su'ed terminal... how?

Paul Richards paul at freebsd-services.com
Mon May 6 17:24:01 BST 2002

On Sun, 2002-05-05 at 02:39, Stefan Foulis wrote:
> Hi
> I've encountered a little problem here. 
> I finally switched over to using a normal user to work with in X instead
> of the far to powerful root. Was about time ;)
> But sometimes I need to use root anyway... so I open a kde terminal, su
> to root and start an application from there. commandline stuff works
> fine like this, but starting an x-app with root privileges doesn't seem
> to work.
> e.g.
> ===
> sf at clt18:~> su - root
> Password:***
> root at clt18:~> konqueror &
> [1] 37417
> root at clt18:~> Xlib: connection to ":0.0" refused by server
> Xlib: No protocol specified
> konqueror: cannot connect to X server :0.0
> [1]+  Exit 1                  konqueror
> root at clt18:~>

First of all, why run konqueror as root? The root user should only be
used to do specific admin tasks that can't be done as any other user.
Use it as little and as sparingly as possible.

To actually answer your question though, look at the xhost manpage. You
can use that command to control who can connect to the X server.

I have 

xhost localhost

in my .xsession which allows all users from localhost to open windows on
my X server.

Paul Richards                   |  FreeBSD DVD releases and merchandise.
FreeBSD Services Ltd            |  Hardware, support and development.
http://www.freebsd-services.com |  Domain names and mail/web hosting.

More information about the Ukfreebsd mailing list