Leave a Comment

In my experience, there are several things it could be. Either file/folder permissions are incorrect, or the file/folder ownership is incorrect.

Before I offer any advice, I must cover and emphasize the following:
Step #1: ALWAYS make a backup of your site files, database, and any other important data.
Step #2: NEVER skip step #1
Step #3: Verify you have a working backup and that you have it in several locations just in case one of the backups is compromised at some point in time.

Now that you have made backups...

The most common fix for me when I encounter this issue is file/folder ownership.

Apache has the user www-data for permissions to do things on the server. You may need to give this user ownership of your WordPress files.

To do this go to your server terminal and enter the comand:

sudo chown -R www-data:www-data /path/to/wordpress/

To explain a bit, "chown" is the command to change the ownership of the files..
"-R" make the command recursive. Meaning... this will effect all files/folders inside the WordPress folder.

"www-data:www-data" this is a way of expressing USER:GROUP in the permissions. This gives user ownership to www-data and group ownership to www-data

"/path/to/wordpress" is the path from the root directory to get to your WordPress files.
an example may be: "/var/www/html/wordpress/" you will need to verify this is the case for your setup to see if your files are here.

Once the command executes, this should change the ownership of the web files to www-data and would allow apache to make changes (such as update WordPress and plugins) to the web files.