File Permissions

Occasionally, WP will have a conniption over file permissions and user/group assignments. The commands below will fix those permissions.

For Centos:

sudo chown -R apache:apache /var/www/html/ && sudo chmod -R g+w /var/www/html/ && sudo find /var/www/html/ -type d -exec chmod 755 {} \; && sudo find /var/www/html/ -type f -exec chmod 644 {} \; && sudo chmod 660 /var/www/html/wp-config.php && sudo chmod 666 /var/www/html/.htaccess

For Ubuntu:

sudo chown -R www-data:www-data /var/www/html/ && sudo chmod -R g+w /var/www/html/ && sudo find /var/www/html/ -type d -exec chmod 755 {} \; && sudo find /var/www/html/ -type f -exec chmod 644 {} \; && sudo chmod 660 /var/www/html/wp-config.php && sudo chmod 666 /var/www/html/.htaccess

For Mac:

sudo chown -R _www:_www /Library/WebServer/Documents/ && sudo chmod -R g+w /Library/WebServer/Documents/ && sudo find /Library/WebServer/Documents/ -type d -exec chmod 755 {} \; && sudo find /Library/WebServer/Documents/ -type f -exec chmod 644 {} \; && sudo chmod 660 /Library/WebServer/Documents/wp-config.php && sudo chmod 666 /Library/WebServer/Documents/.htaccess

or:

sudo chown -R _www:_www /usr/local/var/www/ && sudo chmod -R g+w /usr/local/var/www/ && sudo find /usr/local/var/www/ -type d -exec chmod 755 {} \; && sudo find /usr/local/var/www/ -type f -exec chmod 644 {} \; && sudo chmod 660 /usr/local/var/www/wp-config.php && sudo chmod 666 /usr/local/var/www/.htaccess

Leave a Reply

Your email address will not be published. Required fields are marked *