title: Laravel - Deleting cache files - insufficient permissions
body: <p>I'm trying to delete some files located in <code>storage/framework/cache/data</code> using <code>php artisan cache:clear</code>. This is silently failing, because the user trying to perform the action does not have write access to these files.</p>
  <p>The files are located on a linux server running Nginx - the folders have the following permissions/owner/group:</p>
  <p><code>drwxr-xr-x www-data www-data</code></p>
  <p>and the files have:</p>
  <p><code>-rw-r--r-- www-data www-data</code></p>
  <p>The user I am trying to delete the cached files with is called <code>deploy</code>, and is a member of the <code>www-data</code> group. I can't use <code>sudo</code> because this command happens during a deploy script.</p>
  <p>I have found this pull request, <a href="https://github.com/laravel/framework/pull/31579" rel="nofollow noreferrer">https://github.com/laravel/framework/pull/31579</a>, which seems to describe my exact problem, and I have also looked at <a href="https://laravel.com/docs/7.x/filesystem#the-local-driver" rel="nofollow noreferrer">https://laravel.com/docs/7.x/filesystem#the-local-driver</a> (under the permissions section). Based on this, I tried adding the following to <code>filesystems.php</code>:</p>
  <pre><code>'permissions' =&gt; [
      'file' =&gt; [
          'public' =&gt; 0775,
          'private' =&gt; 0775,
      ],
      'dir' =&gt; [
          'public' =&gt; 0775,
          'private' =&gt; 0775,
      ],
  ]
  </code></pre>
  <p>under both the <code>public</code> and <code>local</code> disk sections, to see if Laravel created the cache files with these permissions, rather than the ones shown above, however it didn't seem to affect anything. I'm guessing this only applies to files stored or created with the <code>File</code> facade, and not automatically generated cache files?</p>
  <p>How can I set the permissions that Laravel creates these files with?</p>
  <p>Thanks in advance for any help</p>