[conspire] Permissions for a script
rick at linuxmafia.com
Tue Apr 17 13:37:48 PDT 2012
Quoting James Sundquist (sundquistjames at gmail.com):
> Hey all,
> I'm looking for clarification. I wrote a script for system upgrades with
> 755 permissions and wondering how best to improve it. How do I not use
> sudo on any of the commands?
It might be just my being in the middle of a busy day at work and not
having time to ponder -- but the above, to me, leaves me completely
unclear on what problem you're trying to solve, i.e., what is the
obstacle and what is the objective.
You might be trying to create system script that will be executed by
crond for periodic site maintenance. In that case, given that it needs
system privilege, just run it as root. (Naturally, be very careful with
how you write any shell script run as root.)
If, by contrast, you intend to create a script run upon demand by a
non-root user, then that's a different category of problem entirely. As
you probably know, setting SUID-root on a shell script is at minimum a
Very Bad Idea and therefore is not supported by most modern Unixes.
Using sudo is a bit better if you're careful. See:
More information about the conspire