Chris Halcrow
Chris Halcrow

Reputation: 31960

Do commands run with root permissions, if they're inside a bash script that's executed via a crontab under root

If a crontab is created for the root user under Linux, using sudo crontab -e, then anything that's directly run by the crontab will use root permissions - see Is it possible to make a Bash file run as root in crontab?

Does this mean that any commands within the bash script will also inherit root permissions, or will any commands within the bash script need to be explicitly executed with root permissions e.g. sudo docker ps?

Upvotes: 0

Views: 267

Answers (1)

that other guy
that other guy

Reputation: 123490

There is no difference between the root user and root permissions. All scripts in root's crontab will run as root, and all commands therein will also run as root, with all associated permissions.

Upvotes: 3

Related Questions