What command changes the Group setting for a directory?

chmod does not change owner. It changes permissions. chown changes owner (and group if need be) and chgrp changes group.

You can use

chown {-R} [user]{:group} [file|directory]

to set user and group ownership where -R does everything that is inside directory. So sudo chown -R rinzwind:rinzwind /tmp/ would set /tmp/ and everything in it to user rinzwind and group rinzwind.

There is also

chgrp {-R} [group] [file|directory]

if you do not need to touch the user permissions and only need to set the group.

Oh and you can check what group a user belongs to with groups {username}.


In addition to Rinzwind's answer, you might also use chown :group [file|directory] to change the group only and leave the owner intact.

Tags:

Permissions