coreutils: chmod invocation
1
1 13.3 ‘chmod’: Change access permissions
1 =======================================
1
1 ‘chmod’ changes the access permissions of the named files. Synopsis:
1
1 chmod [OPTION]... {MODE | --reference=REF_FILE} FILE...
1
1 ‘chmod’ never changes the permissions of symbolic links, since the
1 ‘chmod’ system call cannot change their permissions. This is not a
1 problem since the permissions of symbolic links are never used.
1 However, for each symbolic link listed on the command line, ‘chmod’
1 changes the permissions of the pointed-to file. In contrast, ‘chmod’
1 ignores symbolic links encountered during recursive directory
1 traversals.
1
1 Only a process whose effective user ID matches the user ID of the
1 file, or a process with appropriate privileges, is permitted to change
1 the file mode bits of a file.
1
1 A successful use of ‘chmod’ clears the set-group-ID bit of a regular
1 file if the file’s group ID does not match the user’s effective group ID
1 or one of the user’s supplementary group IDs, unless the user has
1 appropriate privileges. Additional restrictions may cause the
1 set-user-ID and set-group-ID bits of MODE or REF_FILE to be ignored.
1 This behavior depends on the policy and functionality of the underlying
1 ‘chmod’ system call. When in doubt, check the underlying system
1 behavior.
1
1 If used, MODE specifies the new file mode bits. For details, see the
1 section on ⇒File permissions. If you really want MODE to have a
1 leading ‘-’, you should use ‘--’ first, e.g., ‘chmod -- -w file’.
1 Typically, though, ‘chmod a-w file’ is preferable, and ‘chmod -w file’
1 (without the ‘--’) complains if it behaves differently from what ‘chmod
1 a-w file’ would do.
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 permissions
1 actually changes.
1
1 ‘-f’
1 ‘--silent’
1 ‘--quiet’
1 Do not print error messages about files whose permissions cannot be
1 changed.
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 ‘-v’
1 ‘--verbose’
1 Verbosely describe the action or non-action taken for every FILE.
1
1 ‘--reference=REF_FILE’
1 Change the mode of each FILE to be the same as that of REF_FILE.
1 ⇒File permissions. If REF_FILE is a symbolic link, do not
1 use the mode of the symbolic link, but rather that of the file it
1 refers to.
1
1 ‘-R’
1 ‘--recursive’
1 Recursively change permissions of directories and their contents.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1