DEV Community

Cover image for Understanding Permission (r,w,x)
Aryan Vaishnani
Aryan Vaishnani

Posted on

Understanding Permission (r,w,x)

Linux permissions control:

  1. Who can access files
  2. Who can modify files
  3. Who can execute programs

Permissions are one of the most important Linux security features.

Permission Types

Symbol Meaning Value
r Read 4
w Write 2
x Execute 1

Check Permissions

Use:

ls -l

Example Output

  • rwxr-xr-- 1 aryan dev 1200 file.sh

Permission Breakdown

  • rwxr-xr--

Split into:

  • rwx r-x r--

Meaning

Part Who
rwx Owner permissions
r-x Group permissions
r-- Others permissions

First Character Meaning

Symbol Type
- Regular file
d Directory
l Link

Read Permission (r)

File

Allows viewing content.

Example:

cat file.txt

Directory

Allows listing files.

Example:

ls folder

Write Permission (w)

File

Allows:

  1. Edit
  2. Modify
  3. Delete contents

Directory

Allows:

  1. Create files
  2. Delete files
  3. Rename files

Execute Permission (x)

File

Allows running file as program/script.

Example:

./script.sh

Directory

Allows entering directory.

Example:

cd folder

Permission Groups

Linux permissions apply to:

Group Meaning
User (u) Owner
Group (g) Group members
Others (o) Everyone else

Example

  • rwxr-x---

Meaning:

User Permission
Owner Read, Write, Execute
Group Read, Execute
Others No access

Numeric Permission System

Permission Value
r 4
w 2
x 1

Example

755

Means:

User Permission
Owner rwx (7)
Group r-x (5)
Others r-x (5)

Top comments (0)