Skip to main content

Understand File Permissions

In Linux, not every user can access every file or directory. Some resources are private, others shared, and many are protected by strict rules. These rules are permissions, enforced by the operating system to ensure security and proper access control. Understanding permissions is essential for managing a multi-user environment and safeguarding system integrity.


Users and Groups

# Entity Description
1 User Each person who logs into a Linux system has a unique identity (username).
2 Root User The “superuser” with unrestricted control. Root can install software, change configurations, and access all files.
3 Groups Collections of users who share privileges. Permissions can be assigned to groups instead of individuals.
Each file belongs to a user (owner) and a group. Permissions are defined for three categories: 1. Owner (the file’s creator) 2. Group (members of the file’s group) 3. Others (everyone else)

Types of Permissions

Linux uses a permission model to control who can do what with files and directories. Permissions are represented as rwx (read, write, execute):

Permission Description
r (read) Can open and read the contents of file
w (write) Can edit or destroy the file
x (execute) Can run the file as a program/script
-rwxr-xr--
Entity Description Example Permission
Owner The user who created the file rwx → Owner has full powers
Group Other users who belong to the file’s group r-x → Group can read and execute
Others Everyone else on the system r-- → Others can only read

Permission Commands

  • ls -l: Reveals permissions of files or directories
  • chmod: Changes permissions
  • chown: Changes ownership (user)
  • chgrp: Changes group ownership

Numeric & Symbolic Modes

Permissions can be set in two ways:

Numeric Mode:

# Owner: 7 (rwx), Group: 5 (r-x), Others: 5 (r-x)

chmod 755 spell.sh

Symbolic Mode:

# Gives the owner (u) execute power

chmod u+x spell.sh

Hackers Hint:

Number Permission Description
4 Read Can open and view the file
2 Write Can modify or delete the file
1 Execute Can run the file as a program/script
Combination Sum of values Example: 7 (4+2+1) = read, write, execute
In short, Linux users define who is acting, and permissions define what they’re allowed to do. Together, they form the backbone of Linux’s security and multi-user environment.

Practical Exercises

# Assign file to a group
sudo chgrp groupname automate.sh

# Change ownership to another user (requires root)
sudo chown username automate.sh

# Give the owner execute powers
chmod u+x automate.sh

# Create a file and inspect its permissions
touch automate.sh
ls -l automate.sh

Hackers Quest - Mini Project

Design a Hackers Library:

  • Create a directory called HackersLibrary.
  • Inside, create 3 files.
  • Assign one file to the owner only, one to the group, and one to everyone.
  • Document the permission strings and explain why each file is guarded differently.

Hackes Notebook

Permissions are the guardians of Linux. They decide who may enter, who may write, and who may execute. By mastering permissions, you gain control over both freedom and security in a multi-user system.


Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 28, 2025