|
1 | 1 | ## Python CHMOD Simplifier
|
2 | 2 |
|
| 3 | +### What is CHMOD? |
| 4 | +'CHMOD' is a command used in Unix based systems that is used to change access permissions of files and directories. It is an abbreviation for 'Change Mode.' |
| 5 | + |
| 6 | +The CHMOD numerical format is composed of 3 digits, each ranging between 0 and 7. From left to right, each digit represents the corresponding permissions for _user_, _group_ and _other_ respectively. |
| 7 | + |
| 8 | +Each of these digits represents a binary value which controls the _read_, _write_ and _execute_ permissions pertaining to that group. A value of 1 indicates that the corresponding group is allowed an action, where as 0 indicates that the action is not allowed. |
| 9 | + |
| 10 | +Thus, each digit can be represented as r (read), w (write) and x (execute) symbolically based on the binary value of the indicating digit. |
| 11 | + |
| 12 | +For example, the chmod permission 755 can we interpreted as follows: |
| 13 | + |
| 14 | +| NUMBER | CLASS | BINARY | PERMISSION | rwx | |
| 15 | +|--------|--------|--------|----------------------|-----| |
| 16 | +| 7 | USER | 111 | read, write, execute | rwx | |
| 17 | +| 5 | GROUP | 101 | read, execute | r-x | |
| 18 | +| 5 | OTHERS | 101 | read, execute | r-x | |
| 19 | + |
| 20 | +Thus, 755 in the numerical format would translate to rwxr-xr-x. |
| 21 | + |
| 22 | + |
3 | 23 | ### This script converts symbolic representation of CHMOD permissions to it's numerical equivalent, and the Numerical representation of CHMOD permissions to its Symbolic equivalent as well.
|
4 | 24 | Example (numerical to symbolic representation):
|
5 | 25 | input: 777
|
|
0 commit comments