chmod Command chmod
Change the modes of a file
chmod +modes file
chmod -modes file
The COHERENT system assigns a mode to every file, to govern how
users access the file. The mode grants or denies permission to
read, write, or execute a file.
The mode grants permission separately to the owner of a file, to
users from the owner's group, and to all other users. For a
directory, execute permission grants or denies the right to
search the directory, whereas write permission grants or denies
the right to create and remove files.
In addition, the mode contains three bits that perform special
tasks: the set-user-id bit, the set-group-id bit, and the save-
text or ``sticky'' bit. See the Lexicon entry for the COHERENT
system call chmod for more information on how to use these bits.
The command chmod changes the permissions of each specified file
according to the given mode argument. mode may be either an
octal number or a symbolic mode. Only the owner of a file or the
superuser may change a file's mode. Only the superuser may set
the sticky bit.
A symbolic mode may have the following form. No spaces should
separate the fields in the actual mode specification.
[which] how perm ... [, ...]
which specifies the permissions that are affected by the command.
It may consist of one or more of the following:
a All permissions, equivalent to gou
g Group permissions
o Other permissions
u User permissions
If no which is given, a is assumed and chmod uses the file crea-
tion mask, as described in umask.
how specifies how the permissions will be changed. It can be
= Set permissions
+ Add permissions
- Take away permissions
COHERENT Lexicon Page 1
chmod Command chmod
perm specifies which permissions are changed. It may consist of
one or more of the following:
g Current group permissions
o Current other permissions
r Read permission
s Setuid upon execution
t Save text (sticky bit)
u Current user permissions
w Write permission
x Execute permission
Multiple how/perm pairs have the same which applied to them. One
or more specifications separated by commas tell chmod to apply
each specification to the file successively.
The octal modes (see stat) are as follows:
04000 Set user id upon execution
02000 Set group id upon execution
01000 Sticky bit (save text)
00400 Owner read permission
00200 Owner write permission
00100 Owner execute permission
00040 Group read permission
00020 Group write permission
00010 Group execute permission
00004 Others read permission
00002 Others write permission
00001 Others execute permission
An octal mode argument to chmod is obtained by oring the desired
mode bits together.
***** Examples *****
The first example below sets the owner's permissions to read +
write + execute, and the group and other permissions to read +
execute. The second example adds execute permission for
everyone.
chmod u=rwx,go=rx file
chmod +x file
***** See Also *****
chgrp, chown, commands, ls, stat, umask
COHERENT Lexicon Page 2