In Linux, you can give permissions to files and folders using two methods:
- Numeric Method
- Symbolic Method
1. Numeric Method
In the numeric method, numbers 0 to 7 set the permissions.
This method is called the Octal Method because it assigns permissions using octal (base-8) numbers.
Each digit in the sequence represents a specific category:
- Rightmost digit → Others
- Middle digit → Group
- Leftmost digit → User (owner)
Each number is a combination of read (r), write (w), and execute (x) permissions.
Example:
chmod 754 file.txt 7 → User: read + write + execute 5 → Group: read + execute 4 → Others: read only
The numeric method gives permissions to files and folders in Linux in this way.
2. Symbolic Method
In the symbolic method, permissions are assigned using letters and operators instead of numbers.
Letters:
- r → read
- w → write
- x → execute
Operators:
- + → add a permission
- - → remove a permission
- = → set a specific permission
Categories:
- u → user (owner)
- g → group
- o → others
- a → all (user + group + others)
Example:
chmod u=rwx,g=rx,o=r file.txt u=rwx → User (owner) has read, write, and execute permissions g=rx → Group has read and execute permissions o=r → Others have read-only permission
