CHMOD (Change Mode) is a program for setting file/folder permissions.
Note: This is complicated, so don't feel demoralized if you don't pick on this right away.
Every file and folder on a computer contains instructions on who is allowed to read, write and execute the data. There are three user categories used in all file permissions:
- "owner" -- The designated owner of a file/folder. By default it is the user who created it. But the "owner" can be arbitrarily re-aassigned to a different user.
- "group" -- A user group (e.g "administrators").
- "others" -- Users who are neither the "owner" of a file or in applicable "group".
File permissions can be expressed as a three digit value (e.g. 744). The value of each digit, and the order they appear in, determine the access permissions for a file.
The order of each digit represents the relevant party:
- The first digit represents the "owner" of file.
- The second digit represents a "user group" like "administrators."
- The third digit represents "others" (i.e. everyone else).
Each digit represents a permission level:
- 1 (Execute)
- 2 (Write)
- 4 (Read)
- 0 (None)
If you only want the "owner", "group" and "others" to have permission to read the file, you notation would be "444".
But you will probably want users to have multiple permissions. For example, you probably want the owner of the file to have full permissions (execute, write and read) while granting everyone else (group, others) only "read" permission. So what numerical value would you use? For determining the numerical value of execute, write and read, you would add up the values of those basic permissions: 1 (execute) + 2 (write) + 4 (read) = 7. And we know that "read" access is represented by the number "4".
Therefore, the file permission that grants the owner read, write, execute permission (and "read" only permission to everyone else) would be: 744.
A file can be readable, writable, and executable (abbreviated r, w, and x respectively). These values can be expressed using alphabetic or numeric notation.
File permissions can also be expressed using alphabetic notation.
- u (Owner/user)
- g (Group)
- o (Others)
- x (Execute)
- r (Read)
- w (Write)
The notation below reprents "read" and "write" permission for the group.
chown g+rw logo.png