Is there a unix command to give the group the same permissions as the user currently has on a file-by-file basis recursively for a directory tree? I.e. if a file is user writeable it should become group writeable, otherwise it should not be group writeable and so on.
migrated from stackoverflow.com Dec 15 '09 at 17:25
|
I can't think of an easy way to do that with existing commands. Maybe a script like this would help :
Also, keep in mind that some perms for users might not apply to groups, and vice versa. |
|||
|
|
|
I don't know if such a command exists but making use of find and invoking it a few times you can achieve For example: The above command traverses the current directory ".", finds all the files that have write permission for Similarly you use variant above invocation to change the file permissions for read and execute mode for the group. |
|||
|
|
|
Kudos to jamessan for showing us g=u. On my system, this seems to work:
|
|||||||||||
|