LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Unable to launch X apps with non login root shell (https://www.linuxquestions.org/questions/slackware-14/unable-to-launch-x-apps-with-non-login-root-shell-117828/)

kc00l 11-19-2003 10:57 AM

Unable to launch X apps with non login root shell
 
I use Slackware9.1 with kdm/KDE3.1.4.
When I try to launch any X app logged in as a normal user but with root suid for example:

su -c "/opt/kde/bin/kedit"

I receive the following error message:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kedit: cannot connect to X server :0.0

I sense this is a trivial problem caused by my newbieness in my first Slackware months
and I've never really had the need to solve it, since one hardly needs to launch X apps as root
and one should hardly ever login as root... But what about using:

make xconfig/gconfig
or
xcdroast
?

While waiting for some help, I'll keep on searching forums, man pages, X documentation and Google for a solution.

Thanks in advance.

Misel 11-19-2003 11:17 AM

I only know some workarounds - but I believe there is a setting (that will hopefully be posted later on ;))

When I urgently need X as root I do it over the KMenu -> system programs and somewhere there is the Filemanager in superuser mode. There you can log in as root and start the binaries manually.

Another method is to share you X Server with the root user. You have to enter the command xhost 127.0.0.1 as a normal user to allow "external" connections to the running XServer and then su and export DISPLAY=127.0.0.1:0 which will give your session a DISPLAY that X apps can use. Then you should be fine running X apps as root.

Another - and more sophisticated - way is to have two X login screens running. I haven't had the time to find out how yet but it is possible to have several Xs running just like you have several terminals running in runlevel 3.

So you can swith over (possibly with CTRL-ALT-F8) to the other XSession and login as root and run your program there. But... tell me how you did it if you figure it out. ;)

Please consider that the first two solutions are merely a workaround but version 2 also works on a network if you replace the IPs respectively.

kc00l 11-24-2003 03:32 AM

Thanks for your reply Misel.

It really helped me out of this silly problem.

I apologise for my laziness, though. I know I could have solved the problem by myself if I extensively STFW and RTFM, which *in this case*, I didn't.

Well, this had taught me better to do those before asking on the forums.

Thanks again.


All times are GMT -5. The time now is 10:20 AM.