Linux File Permissions: Numeric and Symbolic Methods

|

In Linux, you can give permissions to files and folders using two methods:

  1. Numeric Method
  2. Symbolic Method

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:

  1. Rightmost digit → Others
  2. Middle digit → Group
  3. Leftmost digit → User (owner)
     chmod 754 file.txt
     ━━━━━━━━━━━━━━━━━━━━━━
      7       5       4
      ↓       ↓       ↓
    User   Group  Others
    rwx     r-x     r--
(read,write,execute)  (read,execute)  (read)

Note: - The symbol (-) shows that no permission is allowed.


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
    

Symbolic Method:

The symbolic method is a way to set file and folder permissions in Linux using letters instead of numbers.This method uses symbols to add, remove, or set specific permissions for different categories: u (user/owner), g (group), and o (others).

Permission Symbols (Letters):

The list of letters that represent the different types of permissions is as follows:

  • r → read permission
  • w → write permission
  • x → execute permission

Permission Operators:

The list of operators that define the action you want to perform on a file or folder is as follows:

  • + → add a permission
  • - → remove a permission
  • = → set a specific permission

Permission Categories:

The list of categories that receive different types of permissions:

  • u → user (owner)
  • g → group
  • o → others
  • a → all (user + group + others)

Example: Assign Permissions Using the Symbolic Method

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
    

ONLINE WEB TOOLS

WhatIsMyIpAddress
Shorterner