0

My wp-content folder has owner User and group www-data. The permissions are 775 for folders and 664 for files, so the server can write inside the folder.

But when the server creates folder and files inside wp-content ( when installing theme ), they have the server as owner ( and the server's primary group ) and they get 755 for folder and 644 for files.

So I can't keep all folders and files of a WordPress installation under User ownership.

How can I make all newly created folders and files created by server inside wp-content inherit the ones that the parent folder has?

Thank you.

4
  • 1
    755 and 644 - or even 750 and 640 - are the recommended permissions to set.
    – Nicolai
    Apr 29 '15 at 13:39
  • @ialocin the server is not the owner but only the group so i have to change the ownerships.
    – tioschi
    Apr 29 '15 at 13:43
  • In short, the server should be the owner as the server has the rights to run apache.
    – Nicolai
    Apr 29 '15 at 13:47
  • @ialocin it is not always like that. The owner of the files should be the user the system administrator and the apache user should be the included in the group.
    – tioschi
    May 4 '15 at 7:43
1

If you care about security you should not install themes and plugins from the wordpress admin. Either install them by uploading via FTP or use WP-CLI for that.

There is just no way to change file owners when the script is running in the context of the web server, therefor the only way to maintain reasonable file permissions is to avoid uploading code from the admin.

0

I've had this problem because I host a few Wordpress sites on a few servers. Apache should own everything because Wordpress creates folders and files as it runs. If you want the user to make changes to Wordpress files then add the user to the group apache and change the permissions to 775.

1
  • 1
    this is a solution that a lot people adapt. But it is not always the correct one. Apache should only have access to write inside wp-content, so for the rest files should not have the ability to write. It should only read. That is why you just give him group permissions. I think this is what they propose here.
    – tioschi
    May 13 '15 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.