Aug 11, 2011
tom

What user do scripts in the cron folders run as? (i.e. cron.daily, cron.hourly, etc)

Question

If I put a script in /etc/cron.daily on CentOS what user will it run as? Do they all run as root or as the owner?

Answer

They all run as root. If you need otherwise, use su in the script or add a crontab entry to the user’s crontab (man crontab) or the system-wide crontab (whose location I couldn’t tell you on CentOS).

Related posts:

  1. Run a cron job as the tomcat user
  2. What’s the purpose of cron.daily folder in Ubuntu distro
  3. Why does my backup script work when I run it, but not when it’s run via cron?
  4. How to run cron job on a specific hour every day?
  5. cron not running

Leave a comment