WP-CLI :: Cannot installing plugin as www-data

Based on the issue you’ve reported and preview of the shell bash, it looks as if you may have the wrong owner/group and permissions set for the website’s docroot.

More than likely in your hosting environment, the entire ks320 directory currently does not have www-data as the group assignment.

It can be owned by root but should be assigned to the www-data group (recursively). Running an ls -l from the /var/www directory will output the current permissions, owner, and group assignments to each file and folder.

It probably resembles

drwr-xr-x  ###  root  root  ###   DATE   FILE_OR_FOLDER_NAME

but should resemble:

drwrwxr-x  ###  root  www-data  ###   DATE   FILE_OR_FOLDER_NAME

You can accomplish changing the group assignment from the /var/www directory with the following command:

chown -R root:www-data ks320

Then, you’ll also want to make sure the group has read/write/execute permissions on the directory. You can accomplish this from the /var/www directory with:

chmod -R 775 ks320

Once the permissions and group assignments to the folders have been set, your “www-data” user should be able to create the plugin directory and unzip the wordpress plugin files into place.

For more about recommended permissions for a WordPress site’s files and folders, see https://codex.wordpress.org/Changing_File_Permissions

Leave a Comment