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.
-
What do you mean 755 to 755?– Valentin BajramiJan 15, 2013 at 8:24
Add a 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.
-
I think that the syntax is not quite logical. E.g Directories having permissions 777 will also be getting perms 755. Jan 15, 2013 at 8:41
-
i'm making the changes in my usb drive not in system files..thank you for the answer– GurujiJan 15, 2013 at 8:44
-
-
@val0x00ff: That's exactly what the OP appears to have asked for isn't it - all directories not currently 755 set to 755 ?– user9517Jan 15, 2013 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. Jan 15, 2013 at 8:59
You simplay can run find
and change directories to 755. Example below
find /path/to/dir -type d ! -perm 755 -exec chmod 755 {} \;