Linux Permissions

🔐 Linux Permissions – Mini Study Guide

This topic is SUPER important kasi this controls who can do what in a Linux system.
If Linux is a house 🏠, permissions decide who can enter, modify, or break stuff.


I. Permission Groups (WHO?)

According to page 1, there are three permission groups.

Group

Meaning

Real-Life Analogy

Owner

The user who owns the file

Ikaw may-ari ng notebook

Group

Users in the assigned group

Study group mo

Others (All Users)

Everyone else in the system

Random classmates

Most dangerous? Others (All Users) — kasi that’s everyone.


🔥 Quick Summary

O-G-O
Owner
Group
Others

Memory trick: “Only Good Owners”


II. Permission Types (WHAT can they do?)

There are 3 main types:

Permission

Symbol

Meaning

Read

r

View file contents

Write

w

Modify file

Execute

x

Run file / Access directory


🧠 Real-Life Example

If a file is like a Netflix account:

  • r → You can watch

  • w → You can edit profile

  • x → You can actually run the app


🔥 Quick Summary

RWX = Read, Write, Execute

Memory trick:
“Real Writers Execute”


III. Permission Commands

From page 1–5, these are key commands:

Command

Function

id

Displays user identity

chmod

Changes file permissions

umask

Sets default permissions

su

Become superuser temporarily

sudo

Run command as another user

chown

Change file ownership

chgrp

Change group ownership

passwd

Change password


💡 Important Ones for Exams

  • chmod → change permissions

  • chown → change owner

  • umask → default permissions

Think:
chmod = change mode
chown = change owner


IV. File Types (Seen in ls -l)

On page 1, file types are shown by first character.

Symbol

File Type

-

Regular file

d

Directory

l

Symbolic link

c

Character special file

b

Block special file


🧠 Example

If you run:

ls -l

And you see:

drwxr-xr-x

That d means directory.


V. Octal Notation (chmod Numbers)

On page 2, octal notation is explained.

Each permission has a number value:

Number

Binary

Meaning

0

000

---

1

001

--x

2

010

-w-

3

011

-wx

4

100

r--

5

101

r-x

6

110

rw-

7

111

rwx


🧠 How It Works

r = 4

w = 2

x = 1

Add them:

rw- = 4 + 2 = 6

r-x = 4 + 1 = 5

rwx = 4 + 2 + 1 = 7


🔥 Common Permission Values (Files)

From page 2:

Value

Meaning

777

Everyone can do everything (NOT recommended)

755

Owner full, others read & execute

700

Owner only access

666

Everyone can read & write

644

Owner can write, others read only

600

Owner private access only


Exam Favorite: 755

755 = rwxr-xr-x

Owner → full

Others → read & execute

Common for programs.


🔥 Quick Summary

Think of 3 digits:

[Owner][Group][Others]

Example:

755

7 → Owner

5 → Group

5 → Others

Memory trick:

“Seven is boss, Five can see and run.”


VI. Directory Permission Values

Directories behave differently.

For directories:

  • r → list files

  • w → create/delete files

  • x → enter directory


Example

755 for directory:

Owner → full access

Others → can list files but NOT create/delete


VII. Symbolic Notation (u, g, o)

From page 2–3.

Symbol

Meaning

u

User (owner)

g

Group

o

Others

a

All


Examples (Page 3)

Notation

Meaning

u+x

Add execute to owner

u-x

Remove execute from owner

+x

Add execute to all

o-rw

Remove read/write from others

go=rw

Set group & others to read/write

u+x, go=rx

Multiple changes separated by comma


🧠 How to Read It

Format:

WHO  OPERATOR  PERMISSION

Example:

u + x

Owner add execute


🔥 Quick Summary

Symbolic = letters

Octal = numbers

Memory trick:

UGOA = You Get Ownership Access


VIII. umask Command

This sets default permissions for new files.

Page 3–4 shows binary examples like:

  • umask 0002

  • umask 0022

  • umask 0000


Important Idea

umask subtracts permissions from default.

Example:

umask 0022

Removes write from group and others.


Common One

umask 022 → results in 755 for directories and 644 for files.


IX. su vs sudo

From page 4.

su

Switch user (usually root).

Example:

su -

You become superuser.


sudo

Run a single command as superuser.

Example:

sudo chmod 600 file.txt

Better security practice.


🔥 Quick Difference

su → full session switch

sudo → one command only

Memory trick:

su = switch user

sudo = super do


X. chown and chgrp

From page 4–5.


chown

Change file ownership.

Examples:

Argument

Result

nika

Owner becomes nika

nika:users

Owner nika, group users

:admins

Change group only

nika:

Owner becomes nika, group becomes nika’s login group


chgrp

Change group ownership only.

Example:

sudo chgrp admins file.txt

XI. passwd

Changes user password.

Example:

passwd
sudo passwd user

🔥 FINAL RECAP (Exam Weapon Mode)

1⃣ Permissions have:

  • 3 groups (Owner, Group, Others)

  • 3 types (r, w, x)

2⃣ chmod uses:

  • Octal (755)

  • Symbolic (u+x)

3⃣ 755 = most common

4⃣ 777 = dangerous

5⃣ 700 / 600 = private

6⃣ su vs sudo:

  • su = full switch

  • sudo = one command

7⃣ chown = change owner

8⃣ chgrp = change group

9⃣ umask = default permissions


🧠 MASTER MEMORY TRICK

Think:

Linux Security = 3-3-3 Rule

3 Groups

3 Permissions

3 Digits

And remember:

RWX = 4-2-1