Fedora Linux Support Community & Resources Center
  #1  
Old 27th January 2008, 06:21 PM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
Using Application Launcher to Start Root Program

I have a program that requires root privileges to run. It works properly if I select it through the file system. I will only use it from time to time and I would like to create an application launcher for it. If I select the program through the properties setting of application launcher I wind up having to relog in and the program doesn't run. I have also created a shell script (with root privileges to all) with the path to the file and the same thing happens. The script is:

/home/car/ScanTool.exe

I'm getting these results while logged in as root.

Can I use application launcher to run this app? and how?

Thanks
Reply With Quote
  #2  
Old 27th January 2008, 06:28 PM
lazlow Offline
Registered User
 
Join Date: Aug 2005
Posts: 3,172
A linux program that is a .exe?
Reply With Quote
  #3  
Old 27th January 2008, 06:43 PM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
The code is written for windows but was compiled from source for linux. I just haven't bothered changing the file name from what it created
Reply With Quote
  #4  
Old 27th January 2008, 07:23 PM
RJFUatHOME Offline
Registered User
 
Join Date: Aug 2007
Location: Fairfield, CA
Posts: 437
You could try something along the lines of:

su - --command="/path/programname"

as the command.

It should prompt you for the root password in the default terminal and then run the program. The terminal windows will stay open, but it's quite usefull for seeing program errors and such.
Reply With Quote
  #5  
Old 27th January 2008, 08:15 PM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
Thanks.

When I try this I get a "failed to execute child process" error and Permission denied if I have it set to run as an application.

I I have it set to run in terminal I get a message saying that there was an error creating the child process for this terminal.

As root a have given permissions to all to read and right the script and I get this even if I'm logged in as root.
Reply With Quote
  #6  
Old 27th January 2008, 09:31 PM
lazlow Offline
Registered User
 
Join Date: Aug 2005
Posts: 3,172
It MIGHT have something to do with running the program in a users home rather than in a general access directory.
Reply With Quote
  #7  
Old 27th January 2008, 09:40 PM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello:
You could create a small file and name it startyourapp
and then add to the startyourapp
PHP Code:
#!/bin/bash

cd /path/toyour/app
su 

[
I]yourexecutable[/I
Then to test, double click on the the startyourapp file and select run and it should prompt you for the password.

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
Reply With Quote
  #8  
Old 27th January 2008, 10:04 PM
lmo Offline
Registered User
 
Join Date: Mar 2007
Posts: 1,046
Maybe can do something like xterm -e su -c command
as in:
Code:
xterm -e su -c 'read -p What_for: foo; ls $foo;read -p Hit_enter foo'
And what is userhelper? Does that work for this?

Last edited by lmo; 27th January 2008 at 10:06 PM.
Reply With Quote
  #9  
Old 28th January 2008, 02:37 AM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
I tried:

#!/bin/bash

cd /path/toyour/app
su -
yourexecutable

and it wants to start Crossover Office to run a Windows program.

I also tried removing the exe file extension and still got the same result

I see the open with properties have crossover office and wine listed. I guess this may be the result of having the exe extension.

I removed the exe extension but delete is greyed out when I try to remove the association.


I can't follow the

xterm -e su -c 'read -p What_for: foo; ls $foo;read -p Hit_enter foo'

suggestion
Reply With Quote
  #10  
Old 28th January 2008, 04:21 AM
leadgolem Offline
Registered User
 
Join Date: Apr 2005
Location: Littleton, CO
Age: 30
Posts: 2,857
I had a similiar issue with another app. I don't know about the file association, but this is the script I used to launch my app. I pointed the .desktop launcher at this script.
Code:
#!/bin/bash
if [ ! $( id -u ) -eq 0 ]; then
	zenity --info \
	--title='esg_dump requires admin priveledges.' \
	--text "In order to function properly esg_dump requires root privileges.  Please enter your root password in the following prompt."
	xterm -e su -c 'ps2'
exit ${?}
else
	/usr/local/bin/ps2
fi

exit
This is the same kind of strategy that Imo proposed.

EDIT: Check if you are already root. If not, tell the user why/what we need. The important line.
__________________
S.C.O.U.R.G.E. Heroes of lesser renown, contributor.

Last edited by leadgolem; 28th January 2008 at 04:25 AM.
Reply With Quote
  #11  
Old 28th January 2008, 04:34 AM
leadgolem Offline
Registered User
 
Join Date: Apr 2005
Location: Littleton, CO
Age: 30
Posts: 2,857
Another option would be to use console helper. Take a look at the discussion regarding it in this thread.

EDIT: I have been thinking about doing this for a while now, so I decided to make a rpm for the root-sh/consolehelper solutions proposed by alfal in above link. See attached archive.
Attached Files
File Type: bz2 root-sh-1.0.tar.bz2 (463 Bytes, 120 views)
__________________
S.C.O.U.R.G.E. Heroes of lesser renown, contributor.

Last edited by leadgolem; 28th January 2008 at 05:13 AM.
Reply With Quote
  #12  
Old 28th January 2008, 09:06 AM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
I tried both of the suggested methods. The program starts to open and then the screen goes black and I to re-log in. This is what was happening before when I tried to use application launcher rather than nautilus
Reply With Quote
  #13  
Old 28th January 2008, 09:15 AM
leadgolem Offline
Registered User
 
Join Date: Apr 2005
Location: Littleton, CO
Age: 30
Posts: 2,857
Could you post the contents of the .desktop file you created as the launcher?
__________________
S.C.O.U.R.G.E. Heroes of lesser renown, contributor.
Reply With Quote
  #14  
Old 31st January 2008, 02:24 PM
tmort Offline
Registered User
 
Join Date: Feb 2006
Posts: 284
I've been away for a few days. Here it is:

/usr/bin/root-sh -c "/home/tmort/car2/ScanTool"
Reply With Quote
  #15  
Old 1st February 2008, 03:24 AM
leadgolem Offline
Registered User
 
Join Date: Apr 2005
Location: Littleton, CO
Age: 30
Posts: 2,857
Is that the entire contents? If so, you are missing a few things. Here is an example.
Quote:
Originally Posted by scantool.desktop
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/root-sh -c "/home/tmort/car2/ScanTool"
Path=/home/tmort/car2
Categories=GNOME;Application;System;X-Fedora;
Name=ScanTool
Icon=scantool
__________________
S.C.O.U.R.G.E. Heroes of lesser renown, contributor.
Reply With Quote
Reply

Tags
application, launcher, program, root, start

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Application launcher mckechan Using Fedora 3 18th May 2008 05:11 PM
help creating an application launcher EdgeofNowhere Using Fedora 2 8th May 2006 04:29 PM
Application Launcher not launching... Zigzagcom Programming & Packaging 3 5th July 2005 06:35 PM
Start program as root in gnome. dim3 Using Fedora 4 31st March 2005 04:40 PM
program menu/desktop application launcher yr2alex Using Fedora 6 4th September 2004 04:11 AM


Current GMT-time: 14:25 (Thursday, 30-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Kharagpur Travel Photos on Instagram - Lilienthal - Martina Franca Photos