i have an outbound email that keeps failing with a file permission error. civi created the file with (600 running as nobody) and the cronjob (running as the account owner) can't access that file.

i think this is new behaviour as the user reports that emails with attachments worked before our latest upgrade (458->468)

anyway can i force civi to create attachments with (666) ? this allows the cron user to access the file (which i tested by resending the email -- changing the permission on the attachment manually -- and then scheduling for immediate send)

(and yes i know it's "bad practice" to attach files to bulk emails -- but this is a valid use case. user is sending audition packets to potential members of one of our performing ensembles. only 58 recipients. which BTW is a good reason the hard-limit on direct emails to contacts should be a user-adjustable setting not a hard-coded value in a core file! )

4 Answers 4


It's seems like a bug to me. I can reproduced it on at least one of my site. The permission used to be 660 and is now 600 with the new angular CiviMail.

Can you log an issue in JIRA ?

In the mean time, I think it's possible to use legacy UI instead of Angular but can't find how :(


In my case, i am able to make it work when running the task manually because it's then run as www-data. But it doesn't work when the process is run by cron.

  • Is cron not running for your site as user www-data? Sep 24, 2015 at 20:25
  • No we use Aegir with drush, and cron is then called as user aegir.
    – samuelsov
    Sep 25, 2015 at 18:48
  • Aegir config shares a group between users aegir and www-data to permit cron running as aegir ... If CiviCRM indeed sets permissions to 600 / go-rwx, this will prevent the intended functionality sharing access between the two. This should be reported as an issue in JIRA if it's the case. Dec 19, 2015 at 22:12

We ran into this issue as well and our cron was:

*/1 * * * * username cd $CIVI_ROOT; $PHP bin/cli.php $PARAMS

If I change username to www-data the cron seems to run and send the email with attachment, but I am concerned whether there could be file permission issues if the cron is also trying to write to folders under /home/username that it won't have permission to if run as www-data?


CiviCRM tasks (including CiviCRM cron) should be run as your www user.

It's possible to run CiviCRM tasks as multiple users, but you will have to handle filesystem permissions yourself. Avoid this if you can; it's unlikely to be easier than just running cron under the www user account.

If you're configuring cron as a system job, you can include the username of the user to run the job as:

#mm hh  day mon wkday user      command
*/4 *   *   *   *     www-data  drush @example.org job.execute -u 1 --out=json | logger -t "civicrm[@example.org]"

CiviCRM filesystem permissions issues are also discussed in CiviCRM does not have permission to write temp files - the same issue affects CiviCRM when called from CLI such as wp-cli or drush.

Note that "www user" may vary on different configurations - it may be www-data, nobody, or some other user account. It's the same user as the one which owns the files in your templates_c/ directory.


I suspect that this issue has been fixed in CiviCRM 4.7:

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.