Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

CHMOD(1V)                                                            CHMOD(1V)

       chmod - change the permissions mode of a file

       chmod [ -fR ] mode filename ...

       /usr/5bin/chmod [ -fR ] mode filename ...

       The  System  V  version  of this command is available with the System V
       software installation option.  Refer  to  for  information  on  how  to
       install optional software.

       Change  the permissions (mode) of a file or files.  Only the owner of a
       file (or the super-user) may change its mode.

       The mode of each named file is changed according to mode, which may  be
       absolute or symbolic, as follows.

   Absolute Modes
       An absolute mode is an octal number constructed from the OR of the fol-
       lowing modes:

        400    Read by owner.
        200    Write by owner.
        100    Execute (search in directory) by owner.
        040    Read by group.
        020    Write by group.
        010    Execute (search) by group.
        004    Read by others.
        002    Write by others.
        001    Execute (search) by others.
       4000    Set user ID on execution.
       2000    Set group ID on execution (this bit is ignored if the file is a
               directory; it may be set or cleared only using symbolic mode).
       1000    Sticky bit, (see chmod(2V) for more information).

   Symbolic Modes
       A symbolic mode has the form:

              [ who ] op permission [ op permission ] ...

       who is a combination of:

              u       User's permissions.
              g       Group permissions.
              o       Others.
              a       All, 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  informa-
              tion)  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:

              r       Read.
              w       Write.
              x       Execute.
              X       Give execute permission if the file is a directory or if
                      there is execute permission for one of  the  other  user
              s       Set owner or group ID.  This is only useful with u or g.
                      Also, the set group ID bit of a directory  may  only  be
                      modified with `+' or `-'.
              t       Set  the  sticky  bit  to save program text between pro-

              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

       Multiple symbolic modes, separated by commas, may be given.  Operations
       are performed in the order specified.

       If  who  is  omitted in a symbolic mode, it does not take the file cre-
       ation mask into account, but acts as if who were a.

       -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.  When symbolic links  are
              encountered,  their  mode  is  not changed and they are not tra-

       The first example denies write permission to others, the second makes a
       file executable by all if it is executable by anyone:

              example% chmod o-w file
              example% chmod +X file

       csh(1), ls(1V), sh(1), chmod(2V), chown(8)

                               9 September 1987                      CHMOD(1V)