Ekto gammit

WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY!

permissions_noobie.pngWith issues arising from varying Shared Hosting Packages, versions of PHP, Apache, etc., file permission issues sometimes rear their ugly head. I’m hoping the following reference can provide some help or direction to those less experienced:

A “file not found” “404″, “Unable to create directory”, “cannot open” or “doesn’t exist” error stops things dead in their tracks. This is usually due to a program/script not finding a script or file where it expects to, or it isn’t ‘allowed’ to see it because of the permission settings on the file or it’s directory.

Let’s start with the path. Check your error carefully, it will usually list the path to file in question. I recommend using the FileZilla FTP program .FileZilla interface Open FileZilla and connect to your site. Navigate through the path listed in the error and try to find the file. If it’s missing, try uploading it again and test… If the path is different, verify if you have wordpress installed in the ‘top’ or root directory or if it’s in a sub-directory.

If you found it and the path is correct, check the permissions. 

File permissions image

For this example, I’ll number the permissions flags:

drwxrwxrwx
1234567890

1     directory flag, ‘d’ if a directory, ‘-’ if a normal file, occasionally ‘l’ for a link.
2,3,4     read, write, execute permission for User (Owner) of file
5,6,7     read, write, execute permission for Group
8,9,0     read, write, execute permission for Other (Sometimes called ‘everybody’).

-     in any position means that flag is not set
r     file is readable by owner, group or other
w     file is writeable. On a directory, write access means you can add or delete files
x     file is executable (only for programs and shell scripts – not useful for data files). Execute permission on a directory means you can list the files in that directory
s     in the place where ‘x’ would normally go is called the set-UID or set-groupID flag (On an executable program with set-UID or set-groupID, that program runs with the permissions of its owner/group. On a directory, the set-UID/set-groupID forces files and directories created inside to inherit the user/goup of the parent directory).

“Typical WordPress installs only need the wp-content/ directory to be 777 (temporarily)…”

For security, the permissions settings for WordPress should be 755 for directories and 644 for files. Most hosts, however, require all processes spawned by a user to have a unique identity to add another level of security. So if WordPress or a plugin creates a file or directory, it will have a unique owner (and often group), so the directory with 755 won’t let us create files in it and the file with 644 won’t let us save changes to it. So, a change has to happen.

This is where we hit the “Your Mileage May Vary” area. Typical WordPress installs only need the wp-content/ directory to be 777 (so that WordPress can create the wp-contents/uploads/ folder). If your wp-content/uploads/ already exists you can hop right over and make wp-content/ 755. If you enabled Organize my uploads into month- and year-based folders then the sub-directories need to be checked as well (wp-content/uploads/2012/06 for example), so you will need uploads/ to be 777, 2006/ to be 777 and 06/ to be 777.

This is one reason I suggest you turn off Organize my uploads into month- and year-based folders because you are going to have a problem with permissions every month when a new directory needs to be created. Just let them all go to /wp-content/uploads.

Some people use the editor in the admin to edit theme and plug-in files (I recommend against this unless you can maintain 644 on the files being edited there), discover they have permission issues (as the PHP process will have different credentials on most servers) and change their files to 666. I’m uncomfortable with this. And I have a crush on FileZilla. Yes, I need to get out more.

If I ftp to my site with FileZilla and double-click on a file, it opens in my favorite text editor ( Edit:Settings:File viewing / editing in FileZilla’s menu) and in a much more ‘comfortable’ environment I can make changes, save, and click OK to upload the changed file to the server. The other benefit to this is that the file is being read and written through ftp which maintains my user/group identity, giving me more security and control.

If you have any suggestions for this article, feel free to leave a comment…

Tagged with: , , , , , , ,
Posted in Computers, Things, WordPress
54 comments on “WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY!
  1. Marco says:

    I had never problems with WordPressand CHMOD

  2. Diabetes Reader says:

    Thanks for the most informative article. I had trouble troubleshooting wordpress blog.

  3. Sandra Lewis says:

    Nice information. In shared hosting folder permission should set to 755 and file permission should set to 644.

  4. muamat says:

    Thanks for this helpful discussion. It helped me to solve my wordpress directory permissions problems.

6 Pings/Trackbacks for "WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY!"
  1. Pimp my Politics » Blog Archive » WP permissions says:

    [...] uploads to 775 and turned off Organize my uploads into month- and year in my word press settings. Read this post if you want to read it from the dude I read it [...]

  2. WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY! » Sam Devol says:

    [...] the rest here: WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY! » Sam Devol Tags: file – security – upload Comments0 Leave a Reply Click here to cancel [...]

  3. [...] gönderdikten sonra uploads klasörüne yüklemek yapmak için klasörün yazım kurallarını CHMOD 777 yapmanız [...]

  4. Choice picks for February 26th from 09:45 to 18:21 « Inverse Design says:

    [...] WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY! | Sam Devol – With issues arising from varying Shared Hosting Packages, versions of PHP, Apache, etc., file permission issues sometimes rear their ugly head. I'm hoping [...]

  5. How to Optimize Your Chiropractic Website’s WordPress Settings — Chiropractic Business Network says:

    [...] permissions for the uploads/ directory to 755 instead of 777 as would otherwise be required. (See this blog post for more information on WordPress [...]

  6. [...] WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY! | Sam Devol September 2, 2010 Leave a reply [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recommended Hosting

125x125-495

Donate

Buffy Quotes

pics of buffy cast
I’m gonna do what I should’ve done in the first place. I’ll find her, wherever she is, tie her up, torture her… until she likes me again.