Allow Read/Write Permission to Wordpress

Allow Read/Write Permission to Wordpress

Introduction

Apache 2 - when installed to a Ubuntu server using the apt repository reads and writes using the www-data user. When manually installing a Wordpress site, Apache will try to read and write files using that user and if the owner is not set properly you will not be able to make any meaningful changes to the Wordpress website. The following is how to set the proper folder permissions in Ubuntu for a manual Wordpress installation.

Set Folder Owner

First we are going to assume you have Apache 2 installed and have Virtual Hosts already pointing to the Wordpress folder. I have another article explaining this process from start to finish. For this example I will be using /var/www/wordpress.

Step 1: We need to navigate to the www directory that Apache will be using.

cd /var/www/ 

Step 2: Now we will recursively set the folder owner and group using chown. This command using the -R argument will make sure to make any file and folder inside of the wordpress folder owned by www-data as well.

sudo chown -R www-data:www-data wordpress

Step 3: The final step is checking to make sure the owner has been set properly. We can simply use the ls command with an argument to do this:

ls -l

Conclusion

This process is not very hard nor time consuming but it’s a step I have to take every time I add a new Wordpress website to my web server.

Thanks for reading!
Written By: Max Kulik