Chmod Command – How to Use chmod -R 644 on ~/Documents

chmod

I recently noticed that all of the files in my ~/Documents were somehow incorrectly given executable status. This proved annoying as trying to opening any file gave me a message box saying it was executable. I tried doing a recursive chmod like:

chmod -R 644 ~/Documents

Unfortunately, this made the whole Documents folder inaccessible. What went wrong?

Best Answer

You need to have the execute bit set on a directory to allow the affected user to enter it and access files and directories inside, and you've removed it (your command removes the execute bit from both the files and the folders). There is information about this here. The following command should fix it:

find ~/Documents -type d -exec chmod a+x {} +
Related Question