Home

chmod

chmod is a command in Unix-like operating systems that changes the file mode bits of files and directories. The mode controls whether a file can be read, written, or executed, and it is defined separately for three classes of users: the owner (user), the group, and others. The execute bit is also used to allow entering directories or executing programs.

Modes can be specified either numerically (octal) or symbolically. An octal mode uses digits representing the

Common usage and options include: chmod mode file... to change one or more items, and -R to

ACLs and other extended permissions may interact with the basic mode bits, providing additional or overriding

permissions
for
user,
group,
and
others,
with
each
digit
equal
to
the
sum
of
read
(4),
write
(2),
and
execute
(1).
Special
bits
can
be
included
by
using
a
leading
digit:
setuid
(4),
setgid
(2),
and
the
sticky
bit
(1).
For
example,
755
gives
the
owner
full
permissions
and
read/execute
for
group
and
others,
while
4755
sets
the
setuid
bit
in
addition
to
755
permissions.
A
common
variant
is
1777
for
a
world-writable
directory
with
the
sticky
bit.
Symbolic
modes
use
expressions
like
u+rw,
g-w,
o+x,
or
a+rX,
and
can
be
combined
with
the
target
file
or
directory.
apply
recursively
to
directories.
Other
options
such
as
-v
(verbose),
-c
(changes
only),
and
-f
(suppress
errors)
are
available
on
many
systems.
Examples:
chmod
644
file.txt
for
read/write
by
owner
and
read
by
others;
chmod
u+x
script.sh
to
allow
the
owner
to
execute;
chmod
-R
755
/path/to/dir
to
set
permissions
for
a
directory
tree.
access
in
some
environments.