Every file has permissions for three user types:

Who Symbol Meaning
Owner u The user who created the file
Group g Users in the same group
Others o Everyone else

Permission Types

Symbol Name Meaning
r Read View file contents
w Write Edit or delete file
x Execute Run as a program
- None Permission not granted

Reading Permissions (ls -l)

-rwxrw-r-- 1 daksh devs 1234 Jan 1 file.txt
- rwx rw- r--
│  │   │   │
│  │   │   └── Others: read only
│  │   └────── Group:  read + write
│  └────────── Owner:  read + write + execute
└───────────── File type (- = file, d = directory)

chmod — Change Permissions

Symbolic Method

chmod [who][+/-/=][permissions] filename
Symbol Meaning
+ Add permission
- Remove permission
= Set exact permission
chmod u+x file.txt        # Give owner execute
chmod g-w file.txt        # Remove write from group
chmod o=r file.txt        # Set others to read only
chmod a+rwx file.txt      # Give everyone all permissions
chmod u+x,g-w file.txt    # Multiple changes at once

Who values: u = owner, g = group, o = others, a = all

Numeric (Octal) Method

Permission Value
Read r 4
Write w 2
Execute x 1
None 0

Add values for each group: rwx = 4+2+1 = 7, rw- = 6, r-- = 4

chmod 777 file.txt    # rwxrwxrwx — everyone full access
chmod 755 file.txt    # rwxr-xr-x — owner full, others read+execute
chmod 644 file.txt    # rw-r--r-- — owner read+write, others read only
chmod 600 file.txt    # rw------- — owner only

chown — Change Ownership