The chmod command allows a user to change the permissions of a file/directory. To use chmod, the user must be the owner of the file.
The syntax of the command is:
-f and -R are options. One or both may be used.
mode may be specified as three octal values (one for each of the three sets of permissions): if any of the permissions r,w, or x bit is set, the corresponding permission is enabled: give it a 1. If not, give it a 0. Then, for each of the three permission groups, interpret the three binary numbers as an octal number.
Using the above example of the file phone.numbers, which had the rwxrwxr- permissions, it would translate to 111 111 100, or 774:
rwx rwx r-If write permission for world (sometimes called others) is added, mode is changed to 776 (or 111 111 110).
111 111 100
7 7 4
mode may also be specified symbolically as +r which would add read permissions to everyone, or as -w which would take away write permissions from everyone (all groups).
filename(s) may be one or more filenames, and/or one or more directories, separated by blank spaces.
For example, to change the permissions on file phone.numbers, from rwxrwxr- to rwxrwxrw-, the command
chmod 776 phone.numbersor
chmod +w phone.numbersor (because we are changing it only in the others group)
chmod go+w phone.numberswhich means ``group others add write", could be used.
Typing the command
chmodby itself will display the usage of the command.
Refer to the UNIX manual of your machine for more options on the command.