WordPress directory and file ownership and permissions

Is WordPress failing to upload, install, or update your plugins, themes, or media files? It’s possible that your directory and file permissions are not set correctly.

chown

The chown command allows you to change user and group ownership for files and directories.

Recursively change user and group ownership of all directories and files to www-data:www-data, from the current directory.

sudo chown -R www-data:www-data . 

chmod

The chmod command changes the access permissions for files and directories.

Recursively change all directory and file permissions from the current directory.

sudo . -type d -exec chmod 755 {} \;  
sudo . -type f -exec chmod 644 {} \; 

wordmove

If you are updating WordPress via wordmove, you may wish to update all directory and file permissions automatically by setting rsync_options in your movefile.yml

 ssh:
    host: YOUR_HOST
    rsync_options: "-og --chown=www-data:www-data --no-perms --chmod=ugo=rwX"


Posted

in

, ,