coreutils: chgrp invocation
1
1 13.2 ‘chgrp’: Change group ownership
1 ====================================
1
1 ‘chgrp’ changes the group ownership of each given FILE to GROUP (which
1 can be either a group name or a numeric group ID) or to the group of an
1 existing reference file. ⇒chown invocation. Synopsis:
1
1 chgrp [OPTION]... {GROUP | --reference=REF_FILE} FILE...
1
1 If GROUP is intended to represent a numeric group ID, then you may
1 specify it with a leading ‘+’. ⇒Disambiguating names and IDs.
1
1 It is system dependent whether a user can change the group to an
1 arbitrary one, or the more portable behavior of being restricted to
1 setting a group of which the user is a member.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-c’
1 ‘--changes’
1 Verbosely describe the action for each FILE whose group actually
1 changes.
1
1 ‘-f’
1 ‘--silent’
1 ‘--quiet’
1 Do not print error messages about files whose group cannot be
1 changed.
1
1 ‘--dereference’
1 Do not act on symbolic links themselves but rather on what they
1 point to. This is the default when not operating recursively.
1
1 Combining this dereferencing option with the ‘--recursive’ option
1 may create a security risk: During the traversal of the directory
1 tree, an attacker may be able to introduce a symlink to an
1 arbitrary target; when the tool reaches that, the operation will be
1 performed on the target of that symlink, possibly allowing the
1 attacker to escalate privileges.
1
1 ‘-h’
1 ‘--no-dereference’
1 Act on symbolic links themselves instead of what they point to.
1 This mode relies on the ‘lchown’ system call. On systems that do
1 not provide the ‘lchown’ system call, ‘chgrp’ fails when a file
1 specified on the command line is a symbolic link. By default, no
1 diagnostic is issued for symbolic links encountered during a
1 recursive traversal, but see ‘--verbose’.
1
1 ‘--preserve-root’
1 Fail upon any attempt to recursively change the root directory,
11 ‘/’. Without ‘--recursive’, this option has no effect. ⇒
Treating / specially.
1
1 ‘--no-preserve-root’
11 Cancel the effect of any preceding ‘--preserve-root’ option. ⇒
Treating / specially.
1
1 ‘--reference=REF_FILE’
1 Change the group of each FILE to be the same as that of REF_FILE.
1 If REF_FILE is a symbolic link, do not use the group of the
1 symbolic link, but rather that of the file it refers to.
1
1 ‘-v’
1 ‘--verbose’
1 Output a diagnostic for every file processed. If a symbolic link
1 is encountered during a recursive traversal on a system without the
1 ‘lchown’ system call, and ‘--no-dereference’ is in effect, then
1 issue a diagnostic saying neither the symbolic link nor its
1 referent is being changed.
1
1 ‘-R’
1 ‘--recursive’
1 Recursively change the group ownership of directories and their
1 contents.
1
1 ‘-H’
1 If ‘--recursive’ (‘-R’) is specified and a command line argument is
11 a symbolic link to a directory, traverse it. ⇒Traversing
symlinks.
1
1 ‘-L’
1 In a recursive traversal, traverse every symbolic link to a
1 directory that is encountered.
1
1 Combining this dereferencing option with the ‘--recursive’ option
1 may create a security risk: During the traversal of the directory
1 tree, an attacker may be able to introduce a symlink to an
1 arbitrary target; when the tool reaches that, the operation will be
1 performed on the target of that symlink, possibly allowing the
1 attacker to escalate privileges.
1
1 ⇒Traversing symlinks.
1
1 ‘-P’
1 Do not traverse any symbolic links. This is the default if none of
1 ‘-H’, ‘-L’, or ‘-P’ is specified. ⇒Traversing symlinks.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1
1 Examples:
1
1 # Change the group of /u to "staff".
1 chgrp staff /u
1
1 # Change the group of /u and subfiles to "staff".
1 chgrp -hR staff /u
1