CHMOD(1)

NAME
chmod - change access mode for files

SYNOPSIS
chmod [-R] mode file ...

OPTIONS

-R  # Change hierarchies recursively

EXAMPLES

chmod 755 file
    # Owner: rwx Group: r-x Others: r-x

chmod +x file1 file2
    # Make file1 and file2 executable

chmod a-w file
    # Make file read only

chmod u+s file
    # Turn on SETUID for file

chmod -R o+w dir
    # Allow writing for all files in dir

DESCRIPTION

The given mode is applied to each file in the file list. If the -R flag is present, the files in a directory will be changed as well. The mode can be either absolute or symbolic. Absolute modes are given as an octal number that represents the new file mode. The mode bits are defined as follows:

	4000    Set effective user id on execution to file's owner id
	2000    Set effective group id on execution to file's group id
	0400    file is readable by the owner of the file
	0200    writeable by owner
	0100    executable by owner
	0070    same as above, for other users in the same group
	0007    same as above, for all other users

Symbolic modes modify the current file mode in a specified way. The form is:

    [who] op permissions { op permissions ...} {, [who] op ... }

The possibilities for who are u, g, o, and a, standing for user, group, other and all, respectively. If who is omitted, a is assumed, but the current umask is used. The op can be +, -, or =; + turns on the given permissions, - turns them off; = sets the permissions exclusively for the given who. For example g=x sets the group permissions to --x.

The possible permissions are r, w, x; which stand for read, write, and execute; s turns on the set effective user/group id bits. s only makes sense with u and g; o+s is harmless.

SEE ALSO
ls(1), chmod(2).