Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-02-2006, 01:40 PM   #1
Registered: Oct 2005
Posts: 31

Rep: Reputation: 15
[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.
Old 01-02-2006, 01:44 PM   #2
Senior Member
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
with the 'su' command u can have root priviledges
Old 01-02-2006, 02:15 PM   #3
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
The other option is to set root's DISPLAY environment variable to the user's session. Something like:
$root ~> export DISPLAY=:0.0
$root ~> ./guiprogram
You may need to do "xhost +" 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.
Old 01-02-2006, 02:21 PM   #4
Registered: Oct 2005
Posts: 31

Original Poster
Rep: Reputation: 15
Thank you. It helped.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: Check if a program is running naimslim89 Programming 12 05-08-2012 11:24 PM
How to run GUI program as root shadkong Slackware 8 09-20-2005 03:24 PM
Bash Script - How do I make sure my program is still running? nro Linux - Newbie 4 08-28-2005 02:57 PM
I can't open gui program in KDE as root shadkong Slackware 5 04-20-2005 01:52 PM
Running user program from root kilativv Linux - Software 2 07-31-2004 01:49 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration