Chomd in linux
If you are familiar with unix-like system, you are definitely using a lot the command chmod to change the access permission in a file or directories.
Like this one:
$ chmod -R 777 myDirectory
means recursively adds read, write and execution permission for owner, group and the others. -R means add these permissions on all files and all sub-directories in myDirecotories.
For the series of digits 777, the first 7 means adds read, write and execution permission for the file's owner; the second 7 means adds read, write and execution permission for users who are members of the file's group; the last 7 means adds read, write and execution permission for users who are neither the file's owner nor members of the file's group.
Besides digit 7, linux has other digits to indicate different permissions. In fact these digits are octal numbers
# | Permission | rwx |
---|---|---|
7 | read, write and execute | rwx |
6 | read and write | rw- |
5 | read and execute | r-x |
4 | read only | r-- |
3 | write and execute | -wx |
2 | write only | -w- |
1 | execute only | --x |
0 | none | --- |