WordPress plugin unable to write to folder

Posted September 1, 2014 9k views

I set up WordPress on a Ubuntu server and used this tutorial to add extra security

I’m having a hard time with some plugins saying they can’t write to folders. I’m trying to install a backup plugin and it says it can’t write to the backups folder even though it is showing as 755.

Here’s what I have for ownership - I think I may have my owners and groups in a muddle.

Can anyone help me make sure they are set up properly?

/var/www/html/wp-content/backups$ ls -alh
drwxr-sr-x 2 wp-user www-data 4.0K Aug 9 11:42 .
drwxr-xr-x 12 wp-user wp-user 4.0K Aug 30 08:35 ..
-rw-rw-r– 1 wp-user wp-user 28 Mar 16 04:01 index.php

1 comment
  • Hi Clare,

    I suspect this issue is due to apache working as the www-data user & group, which is what wordpress is trying to work with/through when writing plugins to your plugins folder.

    Whilst, from what I gather in your comment above, the wp-user has been given ownership of your files & is part of the www-data group(?), wp-user is not the active user running the web server (apache2 service).

    I would try running the following command: chown www-data: /var/www/html -R
    This will give the www-data user (and it’s group) ownership of all the files within the html folder, and should allow WordPress to then write plugins to the folder.

    If for whatever reason, you require your folders to be owned by the wp-user instead, you could set the folder permissions to 775 (755 only gives the group read and execute access, not write access which is what wordpress needs to create the plugin folder and files) - However, ideally I would not recommend this and it could potentially lead to security issues.

    Or you could add the www-data group to all the files whilst keeping the wp-user, using this command: chown wp-user:www-data /var/www/html -R

    Hope that helps!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Thank you so much - that first chown command has done the trick :)