Linux Permissions Guide for Beginners

x32x01
  • by x32x01 ||
In Linux, permissions are the backbone of system security. They control who can access, modify, or execute files and directories. Whether you’re a beginner, developer, or sysadmin, understanding permissions helps you keep your system safe and well-organized. 💪

What Are Linux Permissions? 📂

Every file and directory in Linux has a set of permissions that determine:
  • Who can read its content 🧐
  • Who can modify or delete it ✏️
  • Who can execute it (run scripts or binaries) ⚙️
These permissions ensure that only the right people can interact with specific files - a must for maintaining system integrity and privacy.

The Three Permission Types 👥

In Linux, there are three main types of users involved in file permissions:
  • Owner (User) - The person who created the file or directory. They have full control and can change its permissions.
  • Group - A set of users who share similar access rights. Perfect for teamwork or shared projects.
  • Others - Everyone else on the system who isn’t the owner or in the group.
Each user type can have its own read (r), write (w), and execute (x) permissions.

Permission Basics: r, w, and x ✨

Symbol​
Meaning​
Description​
r
Read​
View file content or list directory contents​
w
Write​
Modify or delete files, or add files in a directory​
x
Execute​
Run scripts or programs, or access directories​

Example: drwxr-xr--

Let’s break it down 👇
  • d → It’s a directory.
  • rwx → The owner can read, write, and execute.
  • r-x → The group can read and execute, but not write.
  • r-- → Others can only read.
So, drwxr-xr-- means the owner has full control, the group can view and enter, and others can only read.



Changing Permissions with chmod 🛠️

You can easily change permissions using the chmod command.

Example 1 – Symbolic mode:​

Code:
chmod u+x script.sh
This gives the user (u) execute permission on script.sh.

Example 2 – Numeric mode:​

Code:
chmod 755 script.sh

Here’s how numeric permissions work:
  • 7 = rwx (read + write + execute)
  • 5 = r-x (read + execute)
  • 0 = --- (no access)

So 755 means:
  • User → full control
  • Group → read and execute
  • Others → read and execute



Changing Ownership with chown 👑

Every file has an owner and a group. You can change them using the chown command:
Code:
sudo chown john:developers project.txt

This assigns john as the owner and developers as the group for project.txt.

Pro tip 💡: Always double-check ownership before changing system files!



Why Permissions Matter 🚨

Correct permissions protect your system from:
  • Unauthorized access 🔐
  • Accidental file deletion ❌
  • Malicious script execution 🧨
In multi-user systems, managing permissions ensures collaboration without compromising security.



Quick Reference Table 📘

TaskCommand Example
View file permissionsls -l
Change permissionschmod 644 file.txt
Add execute permissionchmod +x run.sh
Change file ownersudo chown user file.txt
Change groupsudo chown :group file.txt

Conclusion 🎯

Mastering Linux permissions is one of the most valuable skills for any Linux user. It keeps your data safe, your system stable, and your workflow smooth. 🚀

Think of permissions as your system’s security gate - when managed properly, they protect everything that matters. So go ahead, explore chmod, chown, and take full control of your Linux world. 🐧💻
Linux Permissions.jpeg
 
Last edited: