Brian Cryer's Web Resources


Change Mode

Chmod is an abbreviation for "Change Mode". Chmod is a command line utility available on both Unix and Windows systems which allows the file permissions of files to be changed. (The closest equivalent to Chmod on Windows is the command line utility chmod, but the permissions settings are very different.)

For full details on how to use chmod consult the Unix man pages. The following is intended as a summary:

The syntax for using chmod is as follows:

chmod switches mode file

Where switches can be any of:

Recursive. Change the mode of the directories as well as the files.
Do not follow symbolic links.
Do not display any messages.
For symbolic links, change the mode of the link
Show all files and changes.

The mode indicates file permissions for the owner, group and all users. These can either be expressed using a number or symbolically.

As a number, it appears as a three digit octal number. The first digit specifying the owner permissions, the second group permissions and the final digit all user (i.e. world) permissions. Where each digit is made up of any combination of the following binary flags:

Flag Meaning
4 Allow read
2 Allow write
1 Allow execute (for scripts and programs)

Thus the 8 possible values for each digit are:

Digit Meaning
0 Deny all
1 Execute only (no read or write permissions)
2 Write only.
3 Write or execute (but not read)
4 Read only.
5 Read and execute.
6 Read and write.
7 Allow all.

So to grant the owner full access, members of the group read and execute and all other users execute only, would be:

chmod 751 file

For more information see: