Solving the dreaded “The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php:

If your wordpress update failed with the error

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Help is on the way. Just login to your webserver. Then change directory to the root of the wordpress site. And type in the following incantation:

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


.. tada! And dont forget the dot at the end of that command.

 

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • This fixed my issue on my new WP install on a VPS. Thank you!

  • It would be helpful if you explained what the command line is doing. I can’t tell who you changed the owner to.

    • Terrence Brannon

      Here you go Lee. I’m the guy that wrote up the answer.

      sudo # execute the command using root privileges
      chown # change the ownership of the files
      -R # do so recursively, meaning in this directory and all directories below it

      www-data:www-data # set the owner of the files to the user www-data and the group www-data. You may have to change either or both values based on what user and group your apache server is using on your server.

  • Raj

    Hi! I have no idea where to use this code for the same error! Could you help me out? Thanks a bunch.

    • Terrence Brannon

      Raj, login to your server and type the command at the shell prompt:

      ssh myusername@myserver.com
      shell> cd document_root_of_wordpress_site
      shell> sudo chown -R www-data:www-data .

      And dont forget there is a dot at the end of that line “sudo chown -R www-data:www-data .”

  • blank

    This is wonderful, and here I was chmodding stuff according to the first hits I got in Google, while researching this problem. Very safe and good solution thx!

  • Matt

    I get chown: invalid user: `www-data:www-data’

    • Terrence Brannon

      yes, the user operating the Apache process might be different on your machine.

      to see what groups exist on your machine, type:
      cat /etc/group | sort

      You might need to ask on ServerFault how to find out which user is running the apache process on your machine. On my machine I typed:
      ps -eaf | grep apache2

      and that showed me the apache user was www-data:

      Here is a screenshot of the output of that command:
      https://www.evernote.com/l/ATXlO9WzTWpJBIefmyEHUTTGNc2egBFTz7oB/image.png

    • Terrence Brannon

      Just to make things a bit more clear. Even though the error was invalid user, that string `www-data:www-data’ contains the username, a colon, and then the group. So the first step would be to determine the apache user using the command

      ps -eaf | grep apache2

      And you should see something like below, but not see “www-data” but something else:
      https://www.evernote.com/l/ATXlO9WzTWpJBIefmyEHUTTGNc2egBFTz7oB/image.png

      Once you determine the user that apache2 is running as, then you can replace the www-data before the colon with that username.

  • I could be wrong, but doesn’t this allow visitors to execute code on the server, a big security no-no?

    • Terrence Brannon

      you could be right Philip. Can you demonstrate a case of this compromising a server? I ask in genuine curiosity. In fact, the wordpress instance that we are chatting on has that very command executed. Here is a screenshot: https://www.evernote.com/l/ATUhK4bGJkBHipFnisCgN5B9umjyNjZdrlQB/image.png … this machine is backed up everday so if you do manage to hack in, it would just be educational for you and I and the readers of this thread.

  • Frank W

    Thank you so much for this delightfully simple fix!

  • Cole Grim

    Thanks, worked great. Did this to install the update, then changed back to the user/group I had before.

  • THEMETRUSTnet

    Thanks! your small code helpful for me!

  • Terrence Brannon

    Hallelujah! It still works even now, Oct 20, 2017 — THANK YOU!