Day 4 of 10: Understanding File Permissions in Linux

Intro: Welcome to Day 4 of my 10-day Linux blog series! Today, we’ll dive into one of the most crucial topics for every Linux user and administrator — file permissions. Understanding permissions helps keep your system secure and ensures only the right people can access or modify files.

---

What are File Permissions?

In Linux, everything is treated as a file — including directories and devices. Every file has ownership and permissions associated with it:

User (u) – the file owner

Group (g) – users in the file's group

Others (o) – everyone else

---

Types of Permissions

There are 3 main types of permissions:

Symbol Permission Description

r Read View the contents

w Write Modify or delete

x Execute Run as a program/script

---

Viewing Permissions

Use the ls -l command to view file permissions:

ls -l filename

You’ll see something like:

-rwxr-xr--

Breakdown:

- – file type (- for file, d for directory)

rwx – owner permissions (read, write, execute)

r-x – group permissions (read, execute)

r-- – others permissions (read only)

---

Changing Permissions

Use the chmod command to change file permissions.

Symbolic Mode:

chmod u+x file.sh # Give execute permission to owner

chmod g-w file.txt # Remove write permission from group

chmod o=r file.log # Set read-only for others

Numeric Mode:

Permissions are also represented by numbers:

Permission Binary Value

--- 000 0

--x 001 1

-w- 010 2

-wx 011 3

r-- 100 4

r-x 101 5

rw- 110 6

rwx 111 7

So:

chmod 755 script.sh

Means:

Owner: rwx (7)

Group: r-x (5)

Others: r-x (5)

---

Changing Ownership

To change file ownership:

chown username filename

To change group ownership:

chown :groupname filename

---

Conclusion

That’s it for today! You now understand the basics of file permissions, how to view them, and how to modify them using chmod and chown. This is an essential skill for managing files securely on Linux.

Stay tuned for Day 5, where we’ll explore process management using commands like ps, top, kill, and more!

10
Subscribe to my newsletter

Read articles from Fiza_devops_lover_540 directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Fiza_devops_lover_540
Fiza_devops_lover_540

> "Learning Linux, Git, and Shell scripting on my path to becoming a DevOps Engineer. Sharing my tech journey step by step." "Aspiring DevOps Engineer on a journey from Git to the Cloud. Learning Linux, mastering Shell scripting, and exploring automation one command at a time. Sharing my DevOps learning path and experiences as I grow."