Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 15 down vote accepted

This is what you want:

chmod -R g=u directory
share|improve this answer
Perfect, exactly what I was looking for. Thanks. –  Matthew Feb 20 '12 at 16:42

Your Answer


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.