chmod files differently to directories
10 June 2005
Jan gave me the following piece of advice that I feel I have to write about to help me understand it. What I wanted to do was to set all file to
644 which basically means that the owner can write to it unlike any other losers and it can't be executed. The problem with doing a recursive chmod like this on all files is that you don't want to remove the executability of directories otherwise you won't be able to do useful stuff like
ls inside the directory. The trick is to use the
+X option. This is what I did:
$ sudo chmod -R 644 IssueTrackerProduct $ sudo chmod -R +X IssueTrackerProduct
According to the man pages:
" execute only if the file is a direc- tory or already has execute permission for some user (X)"
I can't find a better reference about it now with Google because whatever I search for seems to always be talking about the little
+x which has a very different meaning.