Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

1 Answer 1

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

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.