Make group permissions same as user permissions

chmodpermissions

I want to set the group permissions for all files and subdirectories within a certain parent directory to whatever the user permission setting for that specific file or directory is.

For example, everything under /path/to/parentdir

# Permissions before
# Path                      Permissions
/path/to/parentdir/file1    755
/path/to/parentdir/file2    644
/path/to/parentdir/file3    600

# Permissions after
/path/to/parentdir/file1    775
/path/to/parentdir/file2    664
/path/to/parentdir/file3    660

I'm hoping there's a simple way to do this in hopefully one command. I can think of ways using a script with a bunch of commands, but it feels like there should be a pretty direct way of doing it.

Thanks in advance!

Best Answer

This is what you want:

chmod -R g=u directory
Related Question