CHMOD(1) | General Commands Manual | CHMOD(1) |
chmod
— Change
files modes
chmod |
[-cRv ] mode
file... |
chmod |
[-cRv ] -F
ref_file file... |
chmod
sets the permissions bits given by
mode or copying permissions from
ref_file on each given file,
mode can be either an octal natural number
between 0 and 7777, or a symbolic operation like
‘+r
’ or
‘g=o-x
’. See the
OCTAL MODE and
SYMBOLIC OPERATIONS sections
for details.
If mode starts with a dash (or is user-provided), it should be broken from options with a preceding double-dash (--) like so:
chmod -v -- -w,+r foobar
Octal natural number between 0 and 7777, which can be obtained by
or'ing the following values:
Uses the following grammar:
mode ::= clause [',' clause]* clause ::= who* action+ action ::= [op | op perm+ | op permcopy] who ::= 'u' | 'g' | 'o' | 'a' op ::= '+' | '-' | '=' perm ::= 'r' | 'w' | 'x' | 'X' | 's' | 't' permcopy ::= 'u' | 'g' | 'o'
Which corresponds to:
clause
’ to apply, each
separated by a comma.
For example ‘g+r,o=g
’
sets read permission for group part and copies to other part the
resulting permissions of the group part.
who
’ and
contains one or more ‘action
’.
When ‘who
’ isn't given,
umask(3) is followed similarly to file
creation.
op
’, optionally
followed by either one or more
‘perm
’, or a single
‘permcopy
’When neither ‘perm
’ nor
‘permcopy
’ were given, set(=)
clears all permissions.
The chmod
utility exits 0 on
success, and >0 if an error occurs.
chmod
should be compliant with the IEEE
Std 1003.1-2024 (“POSIX.1”) specification.
The -c
and -v
options are present for compatibility with other modern systems such as
BusyBox and GNU coreutils. Similarly the -F
option
was created for compatibility with --reference
from
GNU, BusyBox and NetBSD while keeping the
possibility of using short options.
Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
2024-03-12 | Linux 6.6.67-gentoo-x86_64 |