изменить режимы файлов (change the file modes)
Использование в приложениях (Application usage)
Some implementations of the chmod utility change the mode of a
directory before the files in the directory when performing a
recursive (-R
option) change; others change the directory mode
after the files in the directory. If an application tries to
remove read or search permission for a file hierarchy, the
removal attempt fails if the directory is changed first; on the
other hand, trying to re-enable permissions to a restricted
hierarchy fails if directories are changed last. Users should not
try to make a hierarchy inaccessible to themselves.
Some implementations of chmod never used the umask of the process
when changing modes; systems conformant with this volume of
POSIX.1‐2017 do so when who
is not specified. Note the difference
between:
chmod a-w file
which removes all write permissions, and:
chmod -- -w file
which removes write permissions that would be allowed if file
was
created with the same umask.
Conforming applications should never assume that they know how
the set-user-ID and set-group-ID bits on directories are
interpreted.