Server permissions problem solution

Make sure you cd into the correct folder you want the server want to be able to control before you run these commands.

#Change ownership to www-data group which nginx and apache belongs to on all files and folders in the current folder and sub folders.
chown www-data:www-data -R *    
# Change directory permissions rwxr-xr-x on all folders in the current folder
find . -type d -exec chmod 755 {} \; 
# Change file permissions rw-r--r-- on all files in the current folder and sub folders.
find . -type f -exec chmod 644 {} \;  

If you run this in your root folder, make sure you understand file permissions correctly and that your wp-config.php with user credentials now is readable by users that have server access.
This is normally not an issue as its still not accesible from the outside but as a security measure and due to badly configured shared hostings setting wp-config.php to 600 or 640 is recommended if possible.

If you only got issues with editing your theme files make sure you go into the theme folder before running the commands so only the theme is effected.

Add your comment