I need to find all files in a directory where “other” have permissions to read, write, or execute, and I need to apply those permission to “group”.
Example: if file1
has rwxr--rw-
, this would change it to rwxrw-rw-
.
But in the case that “group” has permissions but “other” doesn’t, I need to leave it as is.
I need to use one command for this with no pipes.
Any tips you can help me with?
-perm /mode
form of the command ("Any of the permission bits mode are set for the file") rather than the-perm -mode
form ("All of the permission bits mode are set for the file")chmod
with "symbolic" modes (see the man page) will allow you to surgically set individual bits in a file's mode, without affecting other bits.