Answers.Body: <p>It depends under which user your hosting provider is running the web server (or the PHP process if using FPM). Sometimes the web server runs as your user, sometimes it runs as a generic www-data/httpd user. If you have ssh access and your user can view processes, you can run:</p>
  
  <p><code>ps aux | grep -E '(www|http|apache|php)'</code></p>
  
  <p>(many cpanel-type hosting providers might not even let you see the list of processes)</p>
  
  <p>In any case, I think it's safe to default to:</p>
  
  <ul>
  <li>Any files/directories with php files should be 755/644</li>
  <li>Other directories, where there might be uploads, cache files, logs, should be 775/664. For example: <code>wp-content/uploads/civicrm/</code>.</li>
  </ul>
  
  <p>Related questions:</p>
  
  <ul>
  <li><a href="https://civicrm.stackexchange.com/questions/168/are-there-recommended-directory-ownership-and-permission-settings-for-civicrm-fi">Are there recommended directory ownership and permission settings for CiviCRM files?</a></li>
  <li><a href="https://civicrm.stackexchange.com/questions/6979/unable-to-write-file">Unable to write file</a></li>
  <li><a href="https://civicrm.stackexchange.com/questions/4144/civicrm-does-not-have-permission-to-write-temp-files-on-new-server">CiviCRM does not have permission to write temp files on new server</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-29T17:02:22.573Z
Answers.Text: That's helpful. But I guess I'm going to need to write a script to do the changes on each update. I'll have to work out exactly what needs changing. I'm not clear what you mean by (ex: files/civicrm) is ex: example or except! And I can't find that directory which looks to me as if it might be Drupal rather than WordPress.
Answers.UserDisplayName: Mick Kahn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-29T19:12:53.350Z
Answers.Text: Bad habit. I corrected my answer/example :)
Answers.UserDisplayName: bgm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-30T18:08:35.613Z
Answers.Text: My hosting provider has run a script for me to change all the files to 755/644 and that seems to have resolved the problem and, as yet had no negative effects (though I haven't used it much. I'm not sure about the directories you suggest having as 775/664 because they are set to 755/644 in the distribution and seems OK. Will post my script when I have tried it on a clean site to see exactly what it changes.
Answers.UserDisplayName: Mick Kahn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-29T15:25:31.810Z
Answers.LastActivityDate: 2017-11-29T19:10:22.033Z
Answers.LastEditDate: 2017-11-29T19:10:22.033Z
Answers.UserDisplayName: bgm
Body: <p>I seem to be regularly running into problems with file permissions running on WordPress. The two specific examples are that image browsing and upload didn't work in KCEditor (due to permissions for KCFinder) and the tracked links in bulk mailings were failing. In both cases I got 500 errors from the browser. I found that I needed to change directory permissions to 755 from 775 and file permissions from 664 to 664 in appropriate places. It seems rather random whether directory/file permissions are 775/664 or 755/644.</p>
  
  <p>I think this is due to the way my hosting provider sets up WordPress and does not allow 775/664 permissions and from what I read this will be a common situation with hosting providers that use suexec.</p>
  
  <p>Changing file permissions manually is a work around, but tedious and unreliable. I may be missing some and things not working properly because of this, but not being so obvious. And when it comes to an upgrade I'll have to go through it all again.</p>
  
  <p>Is there a reason why the WordPress CiviCRM is distributed with these file permissions? Is there a reason for the variation in file permissions (and what is the logic)?</p>
  
  <p>If this can't be changed in the distribution, can I safely change all 775 to 755 and all 664 to 644 and how might I do this?</p>
  
  <p>I don't think the versions are relevant, but this applies to CiviCRM 4.7.24 and WordPress 4.9 and also other recent versions earlier this year. The hosting provider is SiteGround.</p>
  
Tags: <wordpress><permissions><filesystem>
Title: file permissions with hosted wordpress
ThreadText: # file permissions with hosted wordpress
  
  (Asked by: username_0 on 2017-11-27)
  
  I seem to be regularly running into problems with file permissions running on WordPress. The two specific examples are that image browsing and upload didn't work in KCEditor (due to permissions for KCFinder) and the tracked links in bulk mailings were failing. In both cases I got 500 errors from the browser. I found that I needed to change directory permissions to 755 from 775 and file permissions from 664 to 664 in appropriate places. It seems rather random whether directory/file permissions are 775/664 or 755/644.
  
  I think this is due to the way my hosting provider sets up WordPress and does not allow 775/664 permissions and from what I read this will be a common situation with hosting providers that use suexec.
  
  Changing file permissions manually is a work around, but tedious and unreliable. I may be missing some and things not working properly because of this, but not being so obvious. And when it comes to an upgrade I'll have to go through it all again.
  
  Is there a reason why the WordPress CiviCRM is distributed with these file permissions? Is there a reason for the variation in file permissions (and what is the logic)?
  
  If this can't be changed in the distribution, can I safely change all 775 to 755 and all 664 to 644 and how might I do this?
  
  I don't think the versions are relevant, but this applies to CiviCRM 4.7.24 and WordPress 4.9 and also other recent versions earlier this year. The hosting provider is SiteGround.
  
  **Tags:** wordpress, permissions, filesystem
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-11-29. Score: 2
  
  It depends under which user your hosting provider is running the web server (or the PHP process if using FPM). Sometimes the web server runs as your user, sometimes it runs as a generic www-data/httpd user. If you have ssh access and your user can view processes, you can run:
  
  `ps aux | grep -E '(www|http|apache|php)'`
  
  (many cpanel-type hosting providers might not even let you see the list of processes)
  
  In any case, I think it's safe to default to:
  
  * Any files/directories with php files should be 755/644
  * Other directories, where there might be uploads, cache files, logs, should be 775/664. For example: `wp-content/uploads/civicrm/`.
  
  Related questions:
  
  * [Are there recommended directory ownership and permission settings for CiviCRM files?](https://civicrm.stackexchange.com/questions/168/are-there-recommended-directory-ownership-and-permission-settings-for-civicrm-fi)
  * [Unable to write file](https://civicrm.stackexchange.com/questions/6979/unable-to-write-file)
  * [CiviCRM does not have permission to write temp files on new server](https://civicrm.stackexchange.com/questions/4144/civicrm-does-not-have-permission-to-write-temp-files-on-new-server)
  
  > **Comments:**
  > **username_0**: That's helpful. But I guess I'm going to need to write a script to do the changes on each update. I'll have to work out exactly what needs changing. I'm not clear what you mean by (ex: files/civicrm) is ex: example or except! And I can't find that directory which looks to me as if it might be Drupal rather than WordPress.  
  > **username_1**: Bad habit. I corrected my answer/example :)  
  > **username_0**: My hosting provider has run a script for me to change all the files to 755/644 and that seems to have resolved the problem and, as yet had no negative effects (though I haven't used it much. I'm not sure about the directories you suggest having as 775/664 because they are set to 755/644 in the distribution and seems OK. Will post my script when I have tried it on a clean site to see exactly what it changes.  
  
  ---
  
  