WordPress failing to update plugins

I have WordPress on Unbutu as well. Maybe this will get you started. (I’m assuming you have access with command line through Terminal via SSH. If that assumption is in error, forgive me.)

In a typical WordPress install there are likely three users, similar to:

root:root 
www-data:www-data  (Apache)
user:user sudo lxd   (WHERE "user" is some name given for SSH access)

*Those users can be found by using the command: ps aux | grep apache

I’ve always found that the only way WP will update plugins, is if the ownership of plugins, and wp-uploads for media, is given to www-data… not the user. In fact I think I even go up to wp-content, then set ownership recursively. I set proper permissions to 755 for directories and 644 for files. (Never 777, that’s bad).

(All my commands are done as sudo user, because I’m SSH-ing in Terminal as my user) Here are some options.

If you want to generically make Apache owner and set permissions on directories and files:

sudo chown www-data:www-data -R *  
sudo . -type d -exec chmod 755 {} \;  
sudo . -type f -exec chmod 644 {} \;  

If you want to specifically make Apache owner on a directory, and set permissions:

sudo chown www-data:www-data -R /var/www/html/wp-content/
sudo find /var/www/html/wp-content/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/wp-content/ -type f -exec chmod 644 {} \;

But if you set permissions on everything in the install directory to 777, you’re going to want to fix that with something like:

sudo find /var/www/html/ -type d -exec -R chmod 755 {} \;
sudo find /var/www/html/ -type f -exec -R chmod 644 {} \;

Then make sure wp-config is hardened with 660 or even 600 permissions.

cd html
sudo chmod 660 wp-config.php