The chmod command changes the access permissions of files and folders. The chmod command, like other commands, can be executed from the command line or through a script file.
This is the proper syntax when using the chmod command:
chmod [options] mode[,mode] file1 [file2 …]
The following are the usual options used with chmod:
-f, –silent, –quiet: Suppresses most error messages.
-v, –verbose: Outputs a diagnostic for every file processed.
-c, –changes: Like verbose but reports only when a change is made.
-R, –recursive: Changes files and directories recursively.
–help: Displays help and exits.
–version: Outputs version information and exits.
Below is a list of numerical permissions that can be set for the user, group, and everyone else on the computer. Next to the number is the read, write, and execute letter equivalent.
7, rwx: Read, write, and execute.
6, rw-: Read and write.
5, r-x: Read and execute.
4, r–: Read-only.
3, -wx: Write and execute.
2, -w-: Write only.
1, –x: Execute only.
0, —: None.