Name
chmod
Synopsis
chmod [option]mode files
Changes the
access
mode of one or more
files. Only the owner of a file or a
privileged user may change its mode. Create
mode by concatenating the characters from
who, opcode, and
permission. who is optional (if
omitted, default is a); choose only one
opcode.
Options
-
-f Suppress error message upon failure to change a file’s mode.
-
-h Change the permissions of the link, rather than the referent.
-
-H If any of the pathnames given in the command line are symbolic links, follow only those links during recursive operation. Works only with the
-Roption.-
-L Follow all symbolic links during recursive operation. Works only with the
-Roption.-
-P Follow no symbolic links during recursive operation. Works only with the
-Roption (the default).-
-R Recursively descend directory arguments while setting modes.
-
-v Verbose output, showing files as they are changed. If
-vappears more than once, the old and new permissions are shown as well.
Who
-
u User
-
g Group
-
o Other
-
a All (default)
Opcode
-
+ Add permission
-
- Remove permission
-
= Assign permission (and remove permission of the unspecified fields)
Permission
-
r Read
-
w Write
-
x Execute (file) or search (directory)
-
X Set the execute bit for all who values if any of the execute bits are already set in the specified file; meaningful only in conjunction with the op symbol
+-
s Set user (or group) ID
-
t Sticky bit; save text mode (file) or prevent removal of files by nonowners (directory)
-
u User’s present permission
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access