[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 1

chgrp Command

Purpose

Changes the group ownership of a file or directory.

Syntax

chgrp-f ] [-h ] [ -R ] Group File ... Directory ... }

Description

The chgrp command changes the group associated with the specified file or directory to the specified group name or group ID number. When a symbolic link is encountered and you have not specified the -h flag, the chgrp command changes the group ownership of the file or directory pointed to by the link and not the group ownership of the link itself.

If you specify the -h flag, the chgrp command has the opposite effect and changes the group ownership of the link itself and not that of the file or directory pointed to by the link.

If you specify both the -h flag and the -R flag, the chgrp command descends the specified directories recursively, and when a symbolic link is encountered, the group ownership of the link itself is changed and not that of the file or directory pointed to by the link.

Flags

-f Suppresses all error messages except usage messages.
-h Changes the group ownership of an encountered symbolic link and not that of the file or directory pointed to by the symbolic link.
-R Descends directories recursively, setting the specified group ID for each file. When a symbolic link is encountered and the link points to a directory, the group ownership of that directory is changed but the directory is not further traversed.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To change the group ownership of the file or directory named proposals to staff:
    chgrp staff proposals
    The group access permissions for proposals now apply to the staff group.
  2. To change the group ownership of the directory named proposals, and of all the files and subdirectories under it, to staff:
    chgrp -R staff proposals
    The group access permissions for proposals and for all the files and subdirectories under it now apply to the staff group.

Files

/usr/bin/chgrp The chgrp command
/etc/group File that identifies all known groups

Related Information

The chown command, groups command.

The chown subroutine, fchown subroutine.

Security Administration in AIX Version 4.3 System Management Guide: Operating System and Devices describes system security.

File Ownership and User Groups in AIX Version 4.3 System User's Guide: Operating System and Devices introduces file ownership and permissions to access files and directories.


[ Previous | Next | Contents | Glossary | Home | Search ]