CHMOD(1V)

NAME
chmod - change mode

SYNOPSIS
chmod [ -fR ] mode filename ...

SYSTEM V SYNOPSIS
chmod mode filename ...

DESCRIPTION
Change the permissions, or mode, of a file or files. Only the owner of a file (or the superuser) may change its mode.

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

  Absolute Modes
An absolute mode is an octal number constructed from the OR of the following 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
1000	sticky bit, (see chmod(2) 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 information) 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 classes
s	set owner- or group-ID.  This is only useful with u or g.
t	set the sticky bit to save program text between processes.

    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 permissions.

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

SYSTEM V DESCRIPTION
If who is omitted in a symbolic mode, it does not take the file creation mask into account, but acts as if who were a. The -f and -R flags do not apply.

OPTIONS

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

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

    chmod o-w file
    chmod +X file

SEE ALSO
ls(1), sh(1), csh(1), chmod(2), chown(8)