match the user’s effective group ID or one of the user’s supplementary group IDs, unless the user has appropriate privileges. Addi‐
tional restrictions may cause the set‐user‐ID and set‐group‐ID bits of MODE or RFILE to be ignored. This behavior depends on the policy and functionality of the underlying chmod system call. When in doubt, check the
underlying system behavior.
For directories chmod preserves set‐user‐ID and set‐group‐ID bits unless you explicitly specify otherwise. You can set or clear the bits with symbolic modes like u+s and g-s. To clear these bits for directories with
a numeric mode requires an additional leading zero like 00755, leading minus like -6000, or leading equals like =755.
RESTRICTED DELETION FLAG OR STICKY BIT
The restricted deletion flag or sticky bit is a single bit, whose interpretation depends on the file type. For directories, it prevents unprivileged users from removing or renaming a file in the directory unless they
own the file or the directory; this is called the restricted deletion flag for the directory, and is commonly found on world‐writable directories like /tmp. For regular files on some older systems, the bit saves the
program’s text image on the swap device so it will load more quickly when run; this is called the sticky bit.
OPTIONS
Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE.
-c, --changes
like verbose but report only when a change is made
-f, --silent, --quiet
suppress most error messages
-v, --verbose
output a diagnostic for every file processed
--no-preserve-root
do not treat ’/’ specially (the default)
--preserve-root
fail to operate recursively on ’/’
--reference=RFILE
use RFILE’s mode instead of MODE values
-R, --recursive
change files and directories recursively
--help display this help and exit
--version
output version information and exit
Each MODE is of the form ’[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+’.
AUTHOR
Written by David MacKenzie and Jim Meyering.
REPORTING BUGS
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
COPYRIGHT
Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
chmod(2)
Full documentation <https://www.gnu.org/software/coreutils/chmod>
or available locally via: info '(coreutils) chmod invocation'
GNU coreutils 9.1 January 2024 CHMOD(1)