Name

chmod

Synopsis

chmod [options] mode files
chmod [options] --reference=filename files

Change the access mode (permissions) of one or more files. Only the owner of a file or a privileged user may change the mode. mode can be numeric or an expression in the form of who opcode permission. who is optional (if omitted, the default is a); choose only one opcode. Separate multiple modes by commas.

Options

-c, --changes

Print information about files that are changed.

-f, --silent, --quiet

Do not notify user of files that chmod cannot change.

--help

Print help message and then exit.

--no-preserve-root

Do not treat / as special. This is the default behavior.

--preserve-root

Do not operate recursively on /.

-R, --recursive

Traverse subdirectories recursively, applying changes.

--reference=filename

Change permissions to match those associated with filename.

-v, --verbose

Print information about each file, whether changed or not.

--version

Print version information and then exit.

Who

u

User.

g

Group.

o

Other.

a

All (default).

Opcode

+

Add permission.

-

Remove permission.

=

Assign permission (and remove permission of the unspecified fields).

Permissions

r

Read.

w

Write.

x

Execute.

X

Execute if file is a directory or already has execute permission for some user.

s

Set user (or group) ID.

t

Sticky bit; used on directories to prevent removal of files by nonowners.

u

User’s present permission.

g

Group’s present permission.

o

Other’s present permission.

Alternatively, specify permissions by a three-digit octal number. The first digit designates owner ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.