LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 01-02-2006, 01:40 PM   #1
billiejoex
Member
 
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
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
with the 'su' command u can have root priviledges
 
Old 01-02-2006, 02:15 PM   #3
Vgui
Member
 
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:
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.
 
Old 01-02-2006, 02:21 PM   #4
billiejoex
Member
 
Registered: Oct 2005
Posts: 31

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


Reply


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


All times are GMT -5. The time now is 09:15 AM.

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