COHERENT manpages

This page displays the COHERENT manpage for chmod [Change the modes of a file].

List of available manpages
Index


chmod -- Command

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 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:

    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.

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().

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,
chmod(),
chmog,
chown,
commands,
ls,
stat,
umask