Correct file permissions for wordpress

To keep your wordpress application secure, it’s root folder should be owned by www-data user. www-data is the user that web servers like Apache and Nginx on Ubuntu use by default for their normal operation. The web server process can access any file that www-data can access. It has no other importance.

If your wordpress folder is owned by root or any other user other than www-data, there is a change that you may not be able to install plugins, add themes or even upload files to your website from the dashboard. To fix the permissions you must execute the below mentioned commands in your shell.

sudo chown www-data:www-data  -R /var/www/wordpress_directory

Also fix the directory and file permissions using the below command

find . -type d -exec chmod 755 {} \; # directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # file permissions rw-r--r--

Leave a Reply

Your email address will not be published.