LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   [bash] running a GUI program as root (https://www.linuxquestions.org/questions/linux-general-1/%5Bbash%5D-running-a-gui-program-as-root-398676/)

billiejoex 01-02-2006 12:40 PM

[bash] running a GUI program as root
 
Hi all. I'm writing a simple backup script in bash.
At a certain point of my script (I run it as "root") I need to launch a graphical program but it isn't possible because I'm logged to X as "user".
Does it is possible to temporary permit root to launch graphical programs?
How can I solve this problem?

Best regards.

nadroj 01-02-2006 12:44 PM

with the 'su' command u can have root priviledges

Vgui 01-02-2006 01:15 PM

The other option is to set root's DISPLAY environment variable to the user's session. Something like:
Code:

$root ~> export DISPLAY=:0.0
$root ~> ./guiprogram

You may need to do "xhost +127.0.0.1" which allows local X connections. Another option is to open an xterm on the local display, using something like "xterm -display :0.0", and launch commands from there.
Hopefully that helps.

billiejoex 01-02-2006 01:21 PM

Thank you. It helped.


All times are GMT -5. The time now is 06:14 AM.