Reset File Permissions WordPress

You may need to reset file/directory permissions on your WordPress build. This could be because you have had an error updating WordPress due to failed permissions on certain files/folders.

Reset Permissions

# Let Apache be owner (on centos this would be apache:apache)
sudo chown -R www-data:www-data /path/to/wordpress/build/
# Change location so you're at the root of the WordPress build
cd /path/to/wordpress/build/
# Change directory permissions rwxr-xr-x
sudo find . -type d -exec chmod 755 {} \;
# Change file permissions rw-r--r--
sudo find . -type f -exec chmod 644 {} \;

Tighten Security

After the setup you should tighten the access rights, according to Official Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.

# Let your useraccount be owner
chown :  -R *
# Let apache be owner of wp-content (on centos this would be apache:apache)
chown www-data:www-data wp-content