I need to suid a script so that it can be executed by users with less permissions. Since you can't suid a script and can only suid an executable I wanted to use the generic script compiler "shc" to create an executable and then set that executable's suid bit. Only problem is that on ubuntu jaunty I can't find shc or when I do apt-get install shc, it's comes back as not found. Is there an alternative to using shc (except writing my own C program) or is it included into a repo that I could add, so that apt-get would find it?
Asked
Active
Viewed 2,748 times
2 Answers
2
Inside the script use sudo
to execute any administrative commands.
If you need sudo to work without requiring a password look at editing the sudoers file to specify the script and give the NOPASSWD option something like this.
USERNAME ALL=(root) NOPASSWD: /usr/local/SCRIPT_NAME ""
-
will that not prompt the user for a password, I just want them to be able to execute ./somescript and be done with it, I don't want them to have to know the password of the user account that the script runs as. – john ryan Aug 17 '09 at 17:23
1
I had this same question over on serverfault - you can edit the sudoers file to grant permission to run a shell script.

Community
- 1
- 1

Tom Ritter
- 99,986
- 30
- 138
- 174