 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

27th January 2008, 06:21 PM
|
|
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
|

27th January 2008, 06:28 PM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 3,172

|
|
|
A linux program that is a .exe?
|

27th January 2008, 06:43 PM
|
|
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
|

27th January 2008, 07:23 PM
|
|
Registered User
|
|
Join Date: Aug 2007
Location: Fairfield, CA
Posts: 438

|
|
|
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.
|

27th January 2008, 08:15 PM
|
|
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.
|

27th January 2008, 09:31 PM
|
|
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.
|

27th January 2008, 09:40 PM
|
 |
Retired Community Manager
|
|
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 54
Posts: 12,376

|
|
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 ... :)
|

27th January 2008, 10:04 PM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 1,047

|
|
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.
|

28th January 2008, 02:37 AM
|
|
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
|

28th January 2008, 04:21 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
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.
Last edited by leadgolem; 28th January 2008 at 04:25 AM.
|

28th January 2008, 04:34 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
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.
Last edited by leadgolem; 28th January 2008 at 05:13 AM.
|

28th January 2008, 09:06 AM
|
|
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
|

28th January 2008, 09:15 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
Could you post the contents of the .desktop file you created as the launcher?
|

31st January 2008, 02:24 PM
|
|
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"
|

1st February 2008, 03:24 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
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
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 18:13 (Tuesday, 21-05-2013)
|
|
 |
 |
 |
 |
|
|