[wellylug] Can't run an x-app using su
David Murray
newslists at electronincantation.net.nz
Tue Jan 3 09:07:42 NZDT 2006
On Tue, 3 Jan 2006, jumbophut wrote:
> 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).
How about writing a prog that calls pppd, handing to pppd any necessary
info, and that then listens to the output produced by pppd and that
responds according to the output of pppd rather than trying to get pppd to
call some other programme.?
I ain't no programmer, but that would seem to be an easy workaround rather
than getting pppd to spawn a lesser-priviliged child process.
And I would have thought that SU was not intended to be called from within
a programme, for security reasons.
Just a suggestion. May or may not work.
Happy New Year to ya
David Murray
More information about the wellylug
mailing list