Results 1 to 2 of 2
Hi all,
I have a script, which contains some privileged commands (sudo ifup eth0 etc). And I want run this script without entering root password. Is there a way I ...
- 08-04-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 1
bash script with root privileges
Hi all,
I have a script, which contains some privileged commands (sudo ifup eth0 etc). And I want run this script without entering root password. Is there a way I can do that? I heard about sticky bit and some other things that can do the trick...
Thanks in advance
- 08-04-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,855
I don't believe the modern kernel will allow you to setuid scripts, only binaries.
Just use sudo to do it - put an entry in sudoers for the user to run the script, and use the NOPASSWD option, e.g.:
BTW, if running the script as root, you shouldn't need sudo commands inside the script itself.Code:joeblow ALL = (root) NOPASSWD: /path/to/superscript.sh


Reply With Quote