There's another alternative to sudo that might make life less complicated. When you say "without giving them root access" I take it to mean that you want just about any user to be able to run this script. There are two special permission bits available: setuid and setgid. When they are set, the file will have root access or root-group access (not sure what the difference is to tell you the truth). The permissions I'm talking about can be set using chmod in octal form (i.e. chmod 764 <files>). To do it, add another octal number to the front. A 4 enables the setuid bit, a 2 enables the setgid bit, and a 1 enables the "sticky bit". As always, you can have any combination (won't go into what the sticky bit does though). In this case, you'd want "chmod 4755 <script file>". Any user can execute it and read it, but only root has permission to write the file. When run, the script will behave as if root launched it.
|