3

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?

10

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 {} +
  • Yeah. I get it now. Directories always need executable bit set. Thanks. – Bernhard Heijstek Nov 15 '11 at 21:52
  • 1
    @BernhardHeijstek: Almost. It can make sense for a directory not to have execute (actually) search permission. If a directory has 644 permission, for example, you can refer to files under that directory only if you already know their names. But I've hardly ever used that feature myself. – Keith Thompson Nov 15 '11 at 22:01
  • Isn't that read, not execute, that prevents "searching"? – janmoesen Nov 15 '11 at 22:22
  • @janmoesen That would depend on what your definition of "searching" is. – Chris Down Nov 15 '11 at 22:31
  • @Chris thanks for sharing this info. i believe i removed the executable bit on my home folder a long time ago, couldn't figure out what went wrong. only now i'm realizing what i did... – ixtmixilix Nov 15 '11 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.