So, working on a unix system, it's common that /tmp has the sticky bit set (i.e. only the owner of the temporary file can write/delete it). This is an issue when running drush cron.

If I upload a file, and the file gets stored in /tmp, then the owner is _www (I'm on a MacOS machine). When I run drush, I'm running it as my own user, so if I run drush cron then my user is attempting to delete the temporary file(s) that was uploaded, and I get a permission denied.

Can anyone think of a simple workaround for this problem?

1 Answer 1


Simply make CRON run drush as _www user. /etc/cron.d suppotys it, it's format is:

#<timing>   <user> <command>

Just make entry for your drush:

11 * * * *    _www   drush

Details, of course, may vary a little.

I used this answer.

  • This assumes he's not on shared hosting and his user account on the server has permissions to access crontab. An alternative is to create a seperate tmp directory either within drupal root and limit it access via an .htaccess file. Or create a seperated /tmp directory elsewhere on the system, such as /home/myuser/php-tmp/. You can then set the location for this tmp folder in admin/config/media/file-system
    – tenken
    Aug 22, 2014 at 15:40
  • @tenken if he is on shared hosting and he is using _www user & shared directory for temp files, then he already has a security hole to be measured in nautical miles, and DoSing him by competitors would be childish play... I haven't even considered that any hosting company would allow configuration like this. I sure hope no hosting company is so careless.
    – Mołot
    Aug 22, 2014 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.