Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to recursively change the access rights of a specific folder to 755 and files to 644 Without using the find function and having sub-directories in that folder (don't want to change those) ?

Currently I'm using chmod 755 -r folderName/

using find I think its something like that :

find /specific_folder/ -type f -print | xargs chmod 644
share|improve this question

migrated from stackoverflow.com Jun 29 '11 at 13:08

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

You can do it this way:

chmod -R a=rX,u+w folderName

For CentOs the command is:

chmod -R a=rx,u+w folderName

But it will rewrite subdirectory permissions. As the consequence: you cannot do what you want with just chmod.

share|improve this answer
    
will that only work on files ? what about sub-directories .. i dont want to change their permissions – Tarek Jun 29 '11 at 11:30
    
yes, it does work for sub-directories as well. – akond Jun 29 '11 at 11:32
    
just tried that and it doesn't work – Tarek Jun 29 '11 at 11:43
    
You mean doesn't work at all or what? – akond Jun 29 '11 at 11:45
    
yes it doesn't work at all – Tarek Jun 29 '11 at 11:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .