LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 09-15-2011, 09:18 AM   #1
homer_3
Member
 
Registered: May 2008
Posts: 99

Rep: Reputation: 15
Prompt for root pw on running executable?


If I'm not logged in as root and try to run any of the admin tools, a UI pops up asking me to put in the root pw.

Is there a way to set any executable that only has root execution privileges to display this prompt and then run the exec?

I just don't wan to have to open a shell and switch to root every time I want to run this exec.
 
Old 09-15-2011, 11:30 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by homer_3 View Post
If I'm not logged in as root and try to run any of the admin tools, a UI pops up asking me to put in the root pw.
That's due to management by PAM.


Quote:
Originally Posted by homer_3 View Post
Is there a way to set any executable that only has root execution privileges to display this prompt and then run the exec?
See 'man consolehelper' to find out how this mechanism works and suggestions for making it work for other applications.


Quote:
Originally Posted by homer_3 View Post
I just don't wan to have to open a shell and switch to root every time I want to run this exec.
The right approach if using a shell would not be to switch to root but use Sudo.
 
Old 09-15-2011, 12:29 PM   #3
homer_3
Member
 
Registered: May 2008
Posts: 99

Original Poster
Rep: Reputation: 15
Quote:
See 'man consolehelper' to find out how this mechanism works and suggestions for making it work for other applications.
Thanks, although I'm getting "The exec() call failed" after setting it up by following this guide http://wiki.centos.org/TipsAndTricks...gRoot#line-169.

I couldn't find anything useful on google about the error. Will this work if the program I'm running is a shell script?
 
Old 09-15-2011, 02:58 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the admin tools do require root privileges to run .That is normal

type in the root password in the pop up or start them as root
 
Old 09-16-2011, 10:59 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by homer_3 View Post
I'm getting "The exec() call failed".
Example works for me. Please post the complete set of commands and the contents of the required files.


Quote:
Originally Posted by homer_3 View Post
Will this work if the program I'm running is a shell script?
With the example at the URI you posted that seems smething you could test yourself. However (unless you post reasons) I would still suggest you use sudo as it only requires the unprivileged user to only know its password and not roots.


Quote:
Originally Posted by John VV View Post
the admin tools do require root privileges to run .That is normal
That's stating the obvious, isn't it?


Quote:
Originally Posted by John VV View Post
or start them as root
I don't think you've read his OP well.
 
Old 09-16-2011, 05:33 PM   #6
homer_3
Member
 
Registered: May 2008
Posts: 99

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
With the example at the URI you posted that seems smething you could test yourself. However (unless you post reasons) I would still suggest you use sudo as it only requires the unprivileged user to only know its password and not roots.
I don't know how I would have got that error if I didn't test it for myself. My reason was already stated. I don't want to have to run the script from the cli.

Quote:
Example works for me. Please post the complete set of commands and the contents of the required files.
I followed the example exactly. I simply replaced "xterm-root" with myApp and PROGRAM was set to the full path to my shell script.

Anyway, I'm thinking shell scripts don't work with this. I found out that exec() is a C API (don't know if it's part of the standard or not). But it simply takes the program you point it to and replaces what was running with that program. So I don't think a shell script would work with this because of that. I was hoping I could do PROGRAM=/bin/sh <path to my shell script>. I think that gave some parsing error. Don't remember what it was. I couldn't find any documentation on if it is possible to pass args to the app that PROGRAM is set to.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running root executable commands within user bash script tommyttt Linux - Software 5 08-28-2011 08:38 PM
Executable Text Files: Disable Run Prompt? 1bloke Linux - Software 2 09-21-2007 11:47 PM
Running a Java executable class from another executable class LUB997 Programming 22 07-24-2005 04:57 AM
running an executable wogga Linux - Software 8 06-12-2004 04:21 AM
how do I make a program executable through the command prompt? iammeuno Linux - Software 1 12-18-2003 03:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:05 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
Open Source Consulting | Domain Registration