Permissions issue when trying to update WordPress

You need to…

  1. … have your files and folders owned by your user. If you have sudo privies with your SSH access this should be easy to accomplish.

    sudo chown -R user ./wordpress_directory
    
  2. … have your files and folders, at least the ones in wp-content, in the same group as the web server. Otherwise you will have trouble with media uploads. Again, not hard.

    sudo chown -R user:webservergroup ./wordpress_directory
    
  3. … have your file permissions correct, so that the user and the group can read and write, and everyone else can just read. Directories need execute permission also or you can’t read from them even if the file permissions are correct inside the directories.

    sudo chmod -R 775 ./wordpress_directory
    

Now the caveats.

  1. I am assuming your server is Linux (Debian, CentOS, about a hundred others), though this should work for BSD (OpenBSD) also. Theoretically, it should work on Darwin (OS X’s BSD core) but I never trust anything about that system.
  2. If you don’t have sudo privies, you will have to ask you host for help.
  3. If your FTP user is different from your SSH user you can still get this to work by adding the FTP user to the webserver’s group.

    sudo useradd -G webservergroup ftpuser
    

    I believe that some flavors of Linux have slightly different names for this command. You may need to look this up for the specific command for your flavor.

  4. The permissions used above are pretty open. You can make them tighter. See the Codex on File Permissions and on Hardening File Permissions. I would get things working with the relatively loose permissions and then tighten things up. Pay special attention to the fact that some files and directories can have must tighter permissions than others.

  5. You can have trouble with PHP’s safe_mode as here: WP upgrade can’t create directory even though perms are 777

I think that should be it, though server configuration can be tricky and I may have forgotten something. I don’t have to configure servers all that often so it is possible that something has slipped my mind. I would suggest looking up every step and understanding exactly what is going on before you do anything. Backups, of course, are always encouraged.

Leave a Comment