next up previous contents
Next: Making Directories - mkdir Up: Miscellaneous Previous: Miscellaneous Shell Properties

File Permissions - chmod

  File permissions, or modes, are set with the chmod program.

All users are allowed to set the read/write/execute permissions for user/group/other on all files that they own. Only the superuser (root) can set the modes on anybodies files, or set the SetUserID, SetGroupID or Sticky permissions.

As outlined above, the octal permissions are: read (4), write (2) and execute (1). Chmod can also work with symbolic permissions.

Who:

u
owner
g
members of the same group
o
others, everyone else
a
all

What:

r
all
w
members of the same group
x
others, everyone else

The ``who'' and ``what'' are combined by using either an equal sign (to set the permissions absolutely), a plus sign (to add permissions) or a minus sign (to subtract permissions).

 chmod a=rw file
 chmod 666 file

 chmod u=rwx,go=r file
 chmod 744 file
The first pair of examples are equivalent, as are the second pair of examples. Chmod has a few options, but perhaps the most useful one is the ``-R'' or ``-recursive'' switch, which makes newer versions of chmod ``walk'' the directory structure altering all subdirectories which fit the pattern specified in the ``file'' argument.


next up previous contents
Next: Making Directories - mkdir Up: Miscellaneous Previous: Miscellaneous Shell Properties

Gordon Haverland
Sat Oct 9 13:50:48 MDT 1999