WordPress Directory Permissions

So recently I moved a WordPress website to a new host. As soon as I completed the move, the plugins for the site began to produce permission errors whenever I tried to do anything. If I tried to deactivate or delete a plugin I would just get an error.

At one point WordPress began to ask me for FTP information to make changes.

Something was clearly off, though the file and folder permissions looked OK. I then realized that the owner of the files and directories had to be changed to www-data. This is the user that WordPress uses to make any changes.

So to fix my WordPress permsions problem I typed in sudo chown -R www-data:www-data /var/www/site Where /var/www/site is the directory where by WordPress website lives. This fixed the issues right away.

So if you are having WordPress permission errors after moving a site to a new host, make sure that user www-data has the needed permissions to edit your WordPress files. On a linux machine you check permissions by using the ls -l command.

Note that this is not the most secure way of doing things. There are some files which WordPress should not be able to alter, such as wp-config.php. For more information as to which files should be protected see http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php