CHMOD(1) BSD CHMOD(1)
NAME
chmod - change mode
SYNOPSIS
chmod [ -Rf ] mode file ...
DESCRIPTION
chmod changes the mode of each named file according to mode, which may be
absolute or symbolic.
An absolute mode is an octal number constructed from the OR of the
following modes:
4000 Set user ID on execution
2000 Set group ID on execution
1000 Sticky bit (the sticky bit is not supported by Domain/OS
BSD)
0400 Read by owner
0200 Write by owner
0100 Execute (search in directory) by owner
0070 Read, write, execute (search) by group
0007 Read, write, execute (search) by others
A symbolic mode has the following form:
[ who ] op permission [ op permission ]
who is a combination of the letters u (for user's permissions), g
(group), and o (other). The letter a stands for all, or ugo. If you
omit who, the default is a, but the setting of the creation mask is taken
into account. See umask(2) for further details on this.
op can be + to add permission to the file's mode, - to take away
permission, or = to assign permission absolutely (all other bits are
reset).
permission is any combination of the letters r (read), w (write), x
(execute), X (set execute only if file is a directory or some other
execute bit is set), s (set owner or group ID), and t (save text -
sticky). The letters u, g, or o indicate that permission is to be taken
from the current mode. Omitting permission is useful only with an equal
sign (=) to take away all permissions.
You can specify multiple symbolic modes separated by commas. Operations
are performed in the order specified. The letter s is useful only with u
or g.
Only the owner of a file (or the super-user) can change its mode.
OPTIONS
-R When you specify -R, chmod recursively descends its directory
arguments, setting the mode for each file as described above.
When symbolic links are encountered, their mode is not changed
and they are not traversed.
-f When you specify this option, chmod does not complain if it
fails to change the mode on a file.
EXAMPLES
To deny others write permission to file1, enter the following command:
chmod o-w file1
To make file1 executable, enter the following command:
chmod +x file1
To make file1 executable by all if it's executable by anyone, enter the
following command:
chmod +X file1
To allow the owner of file1 read, write, and execute permissions to that
file, but allow the group and others only read permission, enter the
following command:
chmod 744 file1
SEE ALSO
chacl(1), ls(1), lsacl(1), chmod(2), stat(2), umask(2), chown(8)