Wordpress file permissions for editing on local Ubuntu development machine

admin2025-01-07  4

I've seen a couple of solutions on this site that solved some permission problems, however, they seem that they create others, at least for me. My setup is a local wordpress installation on Ubuntu 14.04.

For example: when I want to install a plugin from within my wordpress admin area, I used to get asked to enter my FTP details. Surfing for an answer, I found that changing your user:group to www-data:www-data would solve it, and indeed it did.

However, upon making that change, my files stopped being writable from any editor. I tried adding my current user name nasser to the www-data group (I did this with sudo adduser nasser www-data) and even changed all of my file permissions to 775, but to no avail.

So now, I'm switching back and forth between owners/groups if I want to add a plugin or theme while editing. I could settle for simply downloading a plugin/theme and unzipping it manually into wp-content/plugins or /themes Even unzipping a theme/plugin and manually copying it to the appropriate location would require a permission change.

Any help would be much appreciated. If I missed any details, or was unclear, please let me know.

I've seen a couple of solutions on this site that solved some permission problems, however, they seem that they create others, at least for me. My setup is a local wordpress installation on Ubuntu 14.04.

For example: when I want to install a plugin from within my wordpress admin area, I used to get asked to enter my FTP details. Surfing for an answer, I found that changing your user:group to www-data:www-data would solve it, and indeed it did.

However, upon making that change, my files stopped being writable from any editor. I tried adding my current user name nasser to the www-data group (I did this with sudo adduser nasser www-data) and even changed all of my file permissions to 775, but to no avail.

So now, I'm switching back and forth between owners/groups if I want to add a plugin or theme while editing. I could settle for simply downloading a plugin/theme and unzipping it manually into wp-content/plugins or /themes Even unzipping a theme/plugin and manually copying it to the appropriate location would require a permission change.

Any help would be much appreciated. If I missed any details, or was unclear, please let me know.

Share Improve this question edited Sep 20, 2014 at 12:55 Nicolai Grossherr 18.9k8 gold badges64 silver badges109 bronze badges asked Sep 20, 2014 at 10:54 Nasser Al-ShawwaNasser Al-Shawwa 1215 bronze badges 1
  • If the answer has been helpful consider accepting it - if you need more information read What should I do when someone answers my question? and Why is voting important?. – Nicolai Grossherr Commented Sep 30, 2014 at 11:20
Add a comment  | 

2 Answers 2

Reset to default 0

I'm too working on Ubuntu, personally I'm setting things up like this:

sudo chown -R nasser /path/to/your/wordpress/root/
sudo chgrp -R www-data /path/to/your/wordpress/root/
sudo chmod -R 775 /path/to/your/wordpress/root/

I only do this on my local development machine for convenience and a smoother work-flow. One more thing to note, I've moved the www directory into the home directory, symlinking from /var/www/ to /home/user/www/, which is convenient, but shouldn't be necessary.

Do not forget to revert this back before deploying, for this do at the very least this:

sudo chown -R www-data /path/to/your/wordpress/root/
sudo chgrp -R www-data /path/to/your/wordpress/root/
// the last two lines can be combined like:
// sudo chown -R www-data:www-data /path/to/your/wordpress/root/
sudo find /path/to/your/wordpress/root/ -type f -print0 | xargs -0 sudo chmod 644
// the last line could also be done like this:
// sudo find /path/to/your/wordpress/root/ -type f -exec chmod {} 644 \;
sudo find /path/to/your/wordpress/root/ -type d -print0 | xargs -0 sudo chmod 755
// the last line could also be done like this:
// sudo find /path/to/your/wordpress/root/ -type d -exec chmod {} 755 \;
sudo chmod 600 /path/to/your/wordpress/root/wp-config.php

You might of course have other wishes for your file permissions, more about that in the codex articles Changing File Permissions and Hardening WordPress - File Permissions.

if its a local machine with a firwall blocking traffic from the wide internet, going with 777 permissions is reasonable. The main gotcha is if you want to simulate conditions on an actual server in which that is not the wisest thing. 777 is OK if you developing themes or plugins.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736255895a318.html

最新回复(0)