The chmod()
system call, and by extension the chmod
program, does not affect the group of a file or directory (or other type of file: block special, character special, socket, ... symlink is something of a special case). So, the group to which the permission is given will be the group to which the file or directory belongs.
To add group rwx
permissions, you should use:
chmod -R g+rwx DirectoryName
However, this adds the permissions to every file as well as every directory, and not all files should be executable. Personally, I'd be very unhappy if someone provided group write permission on all (or any) of my directories, but that's another story.
To affect directories only, use find
instead:
find DirectoryName -type d -exec chmod g+rwx {} +
(The +
notation is POSIX 2008; not all Unix systems support it, though Linux does.)