Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

chmod files differently to directories


10th of 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.



Comment

gustaf - 11th June 2005  [«« Reply to this]
lite mer hårdrock, lite mindre tänk. bärs bengtsson, bärs för guds skull.
gustaf - 11th June 2005  [«« Reply to this]
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 - 11th June 2005  [«« Reply to this]
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 - 12th June 2005   [«« Reply to this]
He he. Klart jag förstår vad min tjocke gamle jeanskompis har att säga. Syns om en vecka typ.
gustaf - 11th June 2005  [«« Reply to this]
with ruin i mean destroy. sorry ich cant bend it right. Henjeby.
fak3r - 9th January 2006  [«« Reply to this]
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 - 2nd October 2007  [«« Reply to this]
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 - 20th May 2008  [«« Reply to this]
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 - 9th December 2008  [«« Reply to this]
find . -type f -exec chmod 644 {} \;
Double-V - 3rd January 2009  [«« Reply to this]
very nice advice, thanks
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.