Answers.Body: <p>I'm assuming the web server isn't running as <code>root:root</code>.  The normal cause of this is someone SSH/(s)FTP'ing into the box as <code>root:root</code> and executing some command (directly or with sudo) that generate files on the file system that are owned by root.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-10T06:15:24.770Z
Answers.LastActivityDate: 2020-02-10T06:15:24.770Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm new to Craft and have been asked to support a live site that is running on it. I've run into a problem that seems to be due to files on the server being created by the wrong user.</p>
  
  <p>The vast majority of files are owned by the user <code>skillsadmin</code> in group <code>psacln</code>, but randomly some directories and files are being created by user "root", group "root".</p>
  
  <p>Some of these root files are causing errors because they can't be accessed by Craft.</p>
  
  <p>So far this only seems to be happening within the <code>/storage</code> directory.</p>
  
  <p>One example is a single directory in the <code>/storage/runtime/compiled_templates</code> directory (along with its contents) that is causing an internal server error with the preview feature of the <code>Campaign</code> plugin. Another example (though I haven't seen any errors caused by it yet) is apparently random log archive files being created by "root".</p>
  
  <p>The site is running on a VM. I asked the provider's support desk for help but they just said it's an application issue and not their responsibility.</p>
  
  <p>What can I do to ensure that all files written by Craft are created by the correct user?</p>
  
Tags: <error><server><permissions>
Title: Directories and files being created by "root" user, inaccessible to CMS
ThreadText: # Directories and files being created by "root" user, inaccessible to CMS
  
  (Asked by: username_0 on 2020-02-07)
  
  I'm new to Craft and have been asked to support a live site that is running on it. I've run into a problem that seems to be due to files on the server being created by the wrong user.
  
  The vast majority of files are owned by the user `skillsadmin` in group `psacln`, but randomly some directories and files are being created by user "root", group "root".
  
  Some of these root files are causing errors because they can't be accessed by Craft.
  
  So far this only seems to be happening within the `/storage` directory.
  
  One example is a single directory in the `/storage/runtime/compiled_templates` directory (along with its contents) that is causing an internal server error with the preview feature of the `Campaign` plugin. Another example (though I haven't seen any errors caused by it yet) is apparently random log archive files being created by "root".
  
  The site is running on a VM. I asked the provider's support desk for help but they just said it's an application issue and not their responsibility.
  
  What can I do to ensure that all files written by Craft are created by the correct user?
  
  **Tags:** error, server, permissions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-10. Score: 1
  
  I'm assuming the web server isn't running as `root:root`. The normal cause of this is someone SSH/(s)FTP'ing into the box as `root:root` and executing some command (directly or with sudo) that generate files on the file system that are owned by root.
  
  
  ---
  
  