Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i want every directory permission set to 755. So i want to change any directories having permission other 755 to 755. How can i change this without even touching the directories which is already set to 755 permission.
I'm using Ubuntu.

share|improve this question
    
What do you mean 755 to 755? –  val0x00ff Jan 15 '13 at 8:24
add comment

3 Answers

Note that you probably don't want to do this (and you definitely don't want to do this on system directories) but if you're sure then

find /path -type d ! -perm 755

will find all of the directories in /path that don't have 755 as a perm

After reviewing the list then

find /path -type d ! -perm 755 -exec chmod 755 {} +

should do what you want.

share|improve this answer
    
I think that the syntax is not quite logical. E.g Directories having permissions 777 will also be getting perms 755. –  val0x00ff Jan 15 '13 at 8:41
    
i'm making the changes in my usb drive not in system files..thank you for the answer –  Guruji Jan 15 '13 at 8:44
    
do you have any other answer val0x00ff.. –  Guruji Jan 15 '13 at 8:45
    
@val0x00ff: That's exactly what the OP appears to have asked for isn't it - all directories not currently 755 set to 755 ? –  Iain Jan 15 '13 at 8:52
    
@lain I probably misread the question. But if all directories(regardless their current permission status) are to be 755 then the syntax is of course correct. The question still has to be re-articulated. –  val0x00ff Jan 15 '13 at 8:59
add comment

find . -type d -not -perm 0755 -exec chmod 0755 '{}' \; should help you !

share|improve this answer
add comment

You simplay can run find and change directories to 755. Example below

find /path/to/dir -type d ! -perm 755 -exec chmod 755 {} \;

share|improve this answer
add comment

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.