Originally Posted by jpollard
You also have a problem with shell metacharacters.
consider your "sudo chmod <arbitrary file>"...
What if that arbitrary file is/or contains '`rm -rf /`'.....When that gets evaluated it will be reprocessed... with privileges.
It *COULD*...but again, if the shell script is written to look for/reject such things, it will kick out and die. You've got control of what goes in, and how it's tested.
And there are no perfect solutions to anything like this. There will ALWAYS be holes, as long as there are users. At least in this case, they can only run one shell script, and since it's preceded by sudo, the exact string/command will be logged. If someone does something wrong, it'll be VERY easy to spot, which will be a deterrent. And, if that user can't be trusted with sudo rights, they shouldn't be able to run anything as sudo. There's also a bit of security-through-obfuscation, since the user won't know what's in that shell script, what it looks for/logs, or how it works. Just that it DOES.