next up previous contents
Next: Wildcards Up: Files & Directories Previous: Access permissions

Groups

As we know every file has an associated group and every user can be the member of several groups. To find out what groups a user is the member of, we can use the groups command:

$groups
staff root
$

The current group, files will be created as, is the first in the list (in this case staff). In most systems we can access all files, whose group we are in, regardless of whether or not it is the current one. If we want to change the current group we can use the newgrp gif command:

$newgrp root


$groups
root staff
$

To change a file's group we can use the chgrpgif command. It takes as its first argument the group name followed by a list of filenames:

$ls -l a
-rw-r-----   2 markst   staff           0 Jan 21 17:13 a
$chgrp root a
$ls -l a
-rw-r-----   2 markst   root            0 Jan 21 17:13 a
$

A file's group can only be changed to a group the user is a member of.



Mark O. Stitson
Wed Sep 25 10:45:32 BST 1996