Cannot download generated files I have a site (Linux/Drupal/Apache) that generate a .xlsx file from custom code and its saved to files, but after that I cannot download it from drupal, it give permission denied.

Forbidden 
You don't have permission to access xxxxxxx.xlsx on this server.


The upload file is saved with -rw------- or 600 permission, and the user/group from Apache.

If I chmod the file to 644 it works.

How can I made that any file generated in that way, will be -rw-r--r-- or 644 ?
A few things to check:


make sure there is no .htaccess rule that is preventing the download
(it may be inherited).
If using file entity check: /admin/config/media/file-settings and make sure .xls is allowed.
Could be blocked by server security like modsecurity rules, check the apache logs...