cchhmmoodd ++_m_o_d_e_s _f_i_l_e cchhmmoodd --_m_o_d_e_s _f_i_l_eThe 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.
_[_w_h_i_c_h_] _h_o_w _p_e_r_m _._._. _[_, _._._._]
which specifies the permissions that are affected by the command. It may consist of one or more of the following:
aa All permissions, equivalent to ggoouu
gg Group permissions
oo Other permissions
uu User permissions
If no which is given, a is assumed and chmod uses the file creation mask, as described in umask.
how specifies how the permissions will be changed. It can be
== Set permissions
++ Add permissions
-- Take away permissions
perm specifies which permissions are changed. It may consist of one or more of the following:
gg Current group permissions
oo Current other permissions
rr Read permission
ss Setuid upon execution
tt Save text (sticky bit)
uu Current user permissions
ww Write permission
xx Execute permission
Multiple _h_o_w/_p_e_r_m 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.
An octal mode argument to chmod is obtained by ORing the desired mode bits together. For a list of the recognized octal modes, see the Lexicon entry for chmod().
chmod u=rwx,go=rx file
chmod +x file