Picture of Brian Love wearing black against a dark wall in Portland, OR.

Brian Love

chmod directories (and not files)

Here is a quick snippet that I used today and that I might end up needing in the future. I needed to give all directories the execute permission for Apache to be able to traverse the directories.

Here is the error in my Apache error log:

[Thu Mar 26 12:37:24.857559 2015][core:crit] pid 14413Permission denied: [client 127.0.0.1:59372] AH00529: /www/local.brianflove.com/www/scripts/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/www/local.brianflove.com/www/scripts/’ is executable

chmod all directories recursively

So, I used the find command in terminal to update the permission on the files.

$ sudo find /www/local.brianflove.com/www -type d -exec chmod chmod 775 {} +

Now all directories have the following permissions:

Mac Permissions Table

Just in case it is helpful, here is a permissions table for Mac (from freebsd.org).

ValuePermissionDirectory Listing
0No read, no write, no execute---
1No read, no write, execute--x
2No read, write, no execute-w-
3No read, write, execute-wx
4Read, no write, no executer--
5Read, no write, executer-x
6Read, write, no executerw-
7Read, write, executerwx