start page | rating of books | rating of authors | reviews | copyrights

Practical UNIX & Internet Security

Practical UNIX & Internet SecuritySearch this book
Previous: 5.7 chown: Changing a File's Owner Chapter 5
The UNIX Filesystem
Next: 5.9 Oddities and Dubious Ideas
 

5.8 chgrp: Changing a File's Group

The chgrp command lets you change the group of a file. The behavior here mirrors that of chown . Under most modern versions of UNIX , you can change the group of a file if you are either one of the following users:

On older AT&T versions of UNIX , you may set any file you own to any group that you want. That is, you can "give away" files to other groups, the same as you can give away files to other users. Beware.

The chgrp command has the form:

chgrp [ -fRh ] group filelist

The -f and -R options are interpreted the same as they are for the chmod and chown commands. The -h option is a bit different from that of chmod . Under chgrp , the option specifies that the group of the link itself is changed and not what the link points to.

Other entries have the following meanings:

group

The group to which you are changing the file(s). The group may be specified by name or with its decimal GID .

filelist

The list of files whose group you are changing.

For example, to change the group of the file paper.tex to chem , you would type:

% 
chgrp chem paper.tex  % ls -l paper.tex
  -rw-r--r-- 1 kevin      chem      59321 Jul 12 13:54 paper.tex  %


Previous: 5.7 chown: Changing a File's Owner Practical UNIX & Internet Security Next: 5.9 Oddities and Dubious Ideas
5.7 chown: Changing a File's Owner Book Index 5.9 Oddities and Dubious Ideas