CHMOD(1V) — USER COMMANDS
NAME
chmod − change mode
SYNOPSIS
chmod [ −fR ] mode filename ...
SYSTEM V SYNOPSIS
chmod mode filename ...
DESCRIPTION
Change the permissions, or mode, of a file or files. Only the owner of a file (or the superuser) may change its mode.
The mode of each named file is changed according to mode, which may be absolute or symbolic.
Absolute Modes
An absolute mode is an octal number constructed from the OR of the following modes:
400read by owner
200write by owner
100execute (search in directory) by owner
040read by group
020write by group
010execute (search) by group
004read by others
002write by others
001execute (search) by others
4000set user ID on execution
2000set group ID on execution
1000sticky bit, (see chmod(2) for more information)
Symbolic Modes
A symbolic mode has the form:
[ who ] op permission [ op permission ]...
who is a combination of:
uuser’s permissions
ggroup permissions
oothers
aall, or ugo
If who is omitted, the default is a, but the setting of the file creation mask (see umask in sh(1) or csh(1) for more information) is taken into account. When who is omitted, chmod will not override the restrictions of your user mask.
op is one of:
+to add the permission
−to remove the permission
=to assign the permission explicitly (all other bits for that category, owner, group, or others, will be reset).
permission is any combination of:
rread
wwrite
xexecute
Xgive execute permission if the file is a directory or if there is execute permission for one of the other user classes
sset owner- or group-ID. This is only useful with u or g.
tset the sticky bit to save program text between processes.
The letters u, g, or o indicate that permission is to be taken from the current mode for the user-class.
Omitting permission is only useful with =, to take away all permissions.
Multiple symbolic modes, separated by commas, may be given. Operations are performed in the order specified.
SYSTEM V DESCRIPTION
If who is omitted in a symbolic mode, it does not take the file creation mask into account, but acts as if who were a. The −f and −R flags do not apply.
OPTIONS
−f Force. chmod will not complain if it fails to change the mode of a file.
−R recursively descend through directory arguments, setting the mode for each file as described above.
EXAMPLES
The first example denies write permission to others, the second makes a file executable by all if it is executable by anyone:
chmod o−w file
chmod +X file
SEE ALSO
ls(1), sh(1), csh(1), chmod(2), chown(8)
Sun Release 3.2 — Last change: 9 April 1986