[wellylug] Can't run an x-app using su

jumbophut jumbophut at gmail.com
Tue Jan 3 00:48:19 NZDT 2006


I'm in KDE, and in a console I want to be able to run:
su -c 'konsole'

It doesn't work.  I get:
Xlib: connection to ":0.0" refused by server
Xlib: Client is not authorized to connect to Server
konsole: cannot connect to X server :0.0

I've tried writing C programs which call setuid and setgid to change
to my normal non-root user, then call konsole, but that still doesn't
work if I call the C program with 'su'.  I get the connection refused
message, and another telling me "no protocol specified".

Running 'xhost -' first makes everything work, but this seems to be a
"Very Bad Idea" (TM), since it allows any bugger to use your X
display.  Plus, it causes KDE to spew errors for a little while.

'xhost +localhost' does not work, sadly.

Any ideas?

Background: what I really want to do is run an x app (e.g. simple C
prog) from pppd's ip-up script.  Since pppd runs setuid root, I need
root to be able to run x apps (or to be able to fool the system with
setuid and setgid).

--
Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /l at omcgtjuba.phi/')




More information about the wellylug mailing list