LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   X display problems when running things from su (https://www.linuxquestions.org/questions/slackware-14/x-display-problems-when-running-things-from-su-278298/)

natalinasmpf 01-15-2005 11:07 PM

X display problems when running things from su
 
Its slightly minor, since I can bypass it with kdesu, but its so inconvenient at times, so finally I feel motivated to post it here.

I have Slackware 9.1, when say I am a normal user, need to su into root and run say, some admin tools that uses a GUI, I get errors complaining about not being able to connect to the server.

Furthermore, I am not sure if its related, how do I get X to accept all local connections across displays and tty's without having to run xhost with the local arguments and whatnot, and that itself is annoying because it can't be included in a startup script, because if I run it on the commandline, it complains, again.

rgiggs 01-16-2005 12:37 AM

a possibly insecure solution is to run 'xhost +' as the user who is logged in. a better solution is to run the xauth command with the merge option. i ran into the second solution after googling a while ago, so i don't remember how to do it off the top of my head.

EDIT
i was not able to find the exact page i found before, but i read the xauth man page, and this works for me:
Code:

root# xauth merge ~user/.Xauthority
this has effect until the user logs out or closes the x server.

At0mic_PC 01-16-2005 06:25 PM

Run the applications from the command line. 'su -c "kwrite --options /file"

natalinasmpf 01-20-2005 04:49 PM

Quote:

this has effect until the user logs out or closes the x server.
Am I able to use this in an init script?

dowelld 01-20-2005 08:08 PM

You need to create the file /etc/X0.hosts (thats a zero) it needs to be executable (thats 755) and it needs one line for every host that you would like given authority to draw windows on the display.
i.e

localhost
some.host.net
another.host.net

then when you su you need to use the export directive to set the DISPLAY and ensure that it becomes global, like # export DISPLAY=localhost:0.0 you could always consider setting that in the .profile for root

All these zero's represent the display number so if you are on display 100 you can set up a file called /etc/X100.hosts and use that the same way


All times are GMT -5. The time now is 01:08 AM.