How to make a script execute as root, no matter who executes it?
I read about setuid but I'm not sure how to do this.
I'm using Linux, Ubuntu 12.04 LTS.
Be really careful: scripts combined with setuid are dangerous!
If you still want to execute your script with
Another solution using
Afterwards, all users can run the script as root without password:
This is similar to using the wrapper/setuid solution above.
Easiest and safest way is to use SETUID bits in file permissions. that way command permissions will be elevated to file owner permissions.
to prevent script from edition do not set write for everyone bits.