Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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 {} +
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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