Brian Love
Angular + TypeScript Developer in Denver, CO

chmod directories (and not files)

Reading time ~1 minute

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 14413] (13)Permission 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:

  • User: 7 - read/write/execute
  • Group: 7 - read/write/execute
  • World: 5 - read/execute

Mac Permissions Table

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

Value Permission Directory Listing
0 No read, no write, no execute ---
1 No read, no write, execute --x
2 No read, write, no execute -w-
3 No read, write, execute -wx
4 Read, no write, no execute r--
5 Read, no write, execute r-x
6 Read, write, no execute rw-
7 Read, write, execute rwx

Brian Love

Hi, I'm Brian. I am interested in TypeScript, Angular and Node.js. I'm married to my best friend Bonnie, I live in Denver and I ski (a lot).