Solution for: #119: Set execute permission for directories
Use the special permission X
- yliu on August 07, 2011, 10:10 AM UTC
So instead of using (for example) chmod -R g+rx ., use
The capitalized X sets the executable bit only if the target is a directory. Per the man page:
So you can't use it to remove executable bits on directories, but definitely can use it to set the executable permission bit.
chmod -R g+rX .
The capitalized X sets the executable bit only if the target is a directory. Per the man page:
The execute/search bits if the file is a directory or any of the execute/search bits are set in the original (unmodified) mode. Operations with the perm symbol ``X'' are only meaningful in conjunction with the op symbol ``+'', and are ignored in all other cases.
So you can't use it to remove executable bits on directories, but definitely can use it to set the executable permission bit.