Answers.Body: <p>Normally folders in the /craft/storage/runtime/* directory are just cached files.</p>
  
  <p>Those files are generated by craft, so really they're generated by php/php-fpm/nginx/apache or what ever you've got setup.
  Maybe check the user that made those folders are in the www-data group if you do want to look into it further.</p>
  
  <p>The better solution is to completely ignore that folder... Those files do not need to be deployed at all. They're just cached files generated by Craft. So just ignore that directory from your repo completely.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-02T11:07:51.933Z
Answers.Text: +1 on not deploying anything in the storage directory, would avoid the problem.
Answers.UserDisplayName: Adam Gilleard
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-02T11:04:23.720Z
Answers.LastActivityDate: 2015-04-02T11:04:23.720Z
Answers.UserDisplayName: joe
Answers.Body: <p>When Twig creates folders and files within the <code>runtime/compiled_templates</code> folder, it will attempt to create them with <code>777</code> and <code>666</code> permissions, respectively. However it is restricted by the maximum permissions that server will allow it to use, which is <code>644</code> by default (preventing files from being set with permissions that would allow them to be overwritten by another user group).</p>
  
  <p>You could theoretically work around this by <a href="http://www.linuxnix.com/2011/12/umask-define-linuxunix.html" rel="nofollow">changing your server’s umask</a>, but you’re probably better off keeping it set to <code>022</code> and just avoiding deploying anything within the <code>runtime</code> folder in the first place, since it’s <a href="http://buildwithcraft.com/help/craft-storage-gitignore" rel="nofollow">not necessary</a> to begin with.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-02T11:40:48.603Z
Answers.LastActivityDate: 2015-04-02T11:40:48.603Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>We use an automated deploy system when developing with Craft.</p>
  
  <p>We have a deploy user "deploy" and a web server user "www-data"</p>
  
  <p>Deploy is a member of the www-data group.</p>
  
  <p>Our first few deployments went fine but when we hit the point where the system started deleting old version (15 or so in) we started getting errors where it couldn't delete the old files properly.</p>
  
  <p>On examination folders created here - <code>/craft/storage/runtime/compiled_templates</code> have the permission <code>drwxr-xr-x</code> so only www-data can edit/write to them.  Is there anyway we can make this group writable when created rather than having to do a manual clean up?</p>
  
Tags: <deployment>
Title: File Permissions on Compiled Templates
ThreadText: # File Permissions on Compiled Templates
  
  (Asked by: username_0 on 2015-04-02)
  
  We use an automated deploy system when developing with Craft.
  
  We have a deploy user "deploy" and a web server user "www-data"
  
  Deploy is a member of the www-data group.
  
  Our first few deployments went fine but when we hit the point where the system started deleting old version (15 or so in) we started getting errors where it couldn't delete the old files properly.
  
  On examination folders created here - `/craft/storage/runtime/compiled_templates` have the permission `drwxr-xr-x` so only www-data can edit/write to them. Is there anyway we can make this group writable when created rather than having to do a manual clean up?
  
  **Tags:** deployment
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-04-02. Score: 5
  
  Normally folders in the /craft/storage/runtime/\* directory are just cached files.
  
  Those files are generated by craft, so really they're generated by php/php-fpm/nginx/apache or what ever you've got setup.
  Maybe check the user that made those folders are in the www-data group if you do want to look into it further.
  
  The better solution is to completely ignore that folder... Those files do not need to be deployed at all. They're just cached files generated by Craft. So just ignore that directory from your repo completely.
  
  > **Comments:**
  > **username_2**: +1 on not deploying anything in the storage directory, would avoid the problem.  
  
  ---
  
  ### Answer by username_3 on 2015-04-02. Score: 3
  
  When Twig creates folders and files within the `runtime/compiled_templates` folder, it will attempt to create them with `777` and `666` permissions, respectively. However it is restricted by the maximum permissions that server will allow it to use, which is `644` by default (preventing files from being set with permissions that would allow them to be overwritten by another user group).
  
  You could theoretically work around this by [changing your server’s umask](http://www.linuxnix.com/2011/12/umask-define-linuxunix.html), but you’re probably better off keeping it set to `022` and just avoiding deploying anything within the `runtime` folder in the first place, since it’s [not necessary](http://buildwithcraft.com/help/craft-storage-gitignore) to begin with.
  
  
  ---
  
  