Cron task error: WRONG FILE OWNER

cron

I'm using the /etc/cron.d/ folder to store my cron tasks. These tasks are symlinks to my actual file which is kept under VCS. These files are owner by a user named "www-data". I've read that Cron will not run tasks that are under a different owner. (http://klenwell.com/press/2010/11/cron-d/) So how can I make Cron run the cron tabs under a different owner from root? I don't want to change the owner to root, as all these files in this folder is owner by "www-data".

Best Answer

Instead of symlinking the files to /etc/cron.d you could put small scripts in /etc/cron.d which call the script you actually want to run.

Something like:

#!/bin/bash

/srv/www/pathtoactualfile