This post is short — no intro to UNIX file permissions or a plethora of commands, just how to easily setup WordPress file & database permissions!
File permissions and ownership
- Go to directory containing sites (assuming each site is a subfolder):
cd /var/www/
- Set the web service account as the owner (assuming Debian-y):
sudo chown -R www-data:www-data
- Go into the site directory:
cd wordpress
- Set the correct permissions:
sudo find . -type f -exec chmod 664 {} \; && sudo find . -type d -exec chmod 775 {} \; && sudo chmod 660 wp-config.php
Database privileges
The database user requires the following permissions on the WordPress database:
- SELECT
- INSERT
- UPDATE
- DELETE
- CREATE
- ALTER
If you’re on shared hosting you may not be able to change this, in which case skip this section.
That’s it!