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.

Comments

Post your own comment
gustaf

lite mer hårdrock, lite mindre tänk. bärs bengtsson, bärs för guds skull.

gustaf

baba o'riley med the who. ladda hem nu sa jag. hv! annars phantom of the opera med järn maiden. för helvete bengtsson!

gustaf

I wonder if my comments actually are born on your www. så att säga. But let me say jeans and you will understand. Do i make myself clear or am i ruin your www. www=world wide web. jeanskalsong with a kapuschong. balle.

Peter Bengtsson

He he. Klart jag förstår vad min tjocke gamle jeanskompis har att säga. Syns om en vecka typ.

gustaf

with ruin i mean destroy. sorry ich cant bend it right. Henjeby.

fak3r

Thanks, I searched Google for this exact issue, and found your site. Thanks for posting it, I can now open up my directories to patrol agents, but not allow them to run files within. Perfect!

fak3r.com

Marcelo

If you do it in one command you dont need to be root, you can be just the owner of the dir:
chmod -R a-x+X yourdir

jkiv

Also, if you don't want 'other' from accessing...

chmod 640 -R directory
chmod ug+X -R directory

(Posting for my own reference. Thanks for the +X tip! I accidently set all my personal files to executables!)

pyg

find . -type f -exec chmod 644 {} \;

Double-V

very nice advice, thanks

Your email will never ever be published.

Related posts

Go to top of the page