Sudo for full script

All,

When enabling sudo to run a script as root (install scripts, etc), is it required to enable sudo on all the actions/commands in the script or simply on the script itself and everything will run as root?

Thanks in advance,

HB

You just need to enable sudo on the script itself.

1 Like

Thank you for the confirmation Don..

You also need to make sure that sudo is not called from within the script (as some do)

If this is the case and you cannot get them out, then assuming that you are running as root you need to check that root is authorised too. It might seem odd, but the rules for sudo can catch you. We just added a rule to say that root could run anything as root through sudo and all seemed fine.

You may have further problems to consider if you are saying would want to run as some sort of application or service account that then needs to sudo occasionally.

Sorry to chuck in a few worries, but probably best to be prepared.

Robin