Chgrp


The chgrp command may be used by unprivileged users on Unix-like systems to change the group associated with a file system object to one of which they are a member. A file system object has 3 sets of access permissions, one set for the owner, one set for the group and one set for others. Changing the group of an object could be used to change which users can write to a file.

Syntax

chgrp group FSO

Syntax for Unix users

chgrp name_of_group_to_change file_name

Frequently implemented options

-R recurse through subdirectories.
-v verbosely output names of objects changed. Most useful when "FSO" is a list.
-f force or forge ahead with other objects even if an error is encountered.

$ ls -l *.conf
-rw-rw-r-- 1 gbeeker wheel 3545 Nov 04 2011 prog.conf
-rw-rw-r-- 1 gbeeker wheel 3545 Nov 04 2011 prox.conf
$ chgrp staff *.conf
$ ls -l *.conf
-rw-rw-r-- 1 gbeeker staff 3545 Nov 04 2011 prog.conf
-rw-rw-r-- 1 gbeeker staff 3545 Nov 04 2011 prox.conf

The above command changes the group associated with file prog.conf from wheel to staff'. This could be used to allow members of staff to modify the configuration for programs prog and prox.