Skip to main content

Understanding File Permissions in Linux – A Beginner’s Guide

 

Understanding File Permissions in Linux – A Beginner’s Guide

The foundation of Linux systems' security model is file permissions. They decide who can access a system's files and directories and how. An overview of Linux file permissions, their operation, and how to modify them are given in this article.

File permissions in Linux control who can read, write, or execute a file. Understanding these permissions is essential for system security, user management, and smooth application operation. In this guide, you’ll learn what Linux file permissions are, how they work, and how to change them with simple commands.

A fundamental security aspect of Linux is permissions, which regulate who can access, alter, or run files and folders. The owner, the group, and others (everyone else) are the three user classes to which they are assigned.

understanding linux file permissions rwx r-x r-x


What Are File Permissions in Linux?

Every file and directory in Linux has permissions that define:

  • Who can read it

  • Who can modify it

  • Who can execute it

These permissions are divided into three categories:

  1. Owner – the user who created the file

  2. Group – users in the same group

  3. Others – everyone else


Types of Permissions

Linux uses three main permission types:

  • Read (r) – view file content

  • Write (w) – modify or delete file

  • Execute (x) – run file as a program


Viewing File Permissions

Use the ls -l command:

ls -l file.txt

Example output:

-rw-r--r-- 1 user group 1200 Jan 18 file.txt

Breakdown:

  • - : file type

  • rw- : owner permissions

  • r-- : group permissions

  • r-- : others permissions


Understanding Permission Format

Format:

rwxr-xr--

Meaning:

  • Owner: rwx (read, write, execute)

  • Group: r-x (read, execute)

  • Others: r-- (read only)


File vs Directory Permissions

For files:

  • r → read file

  • w → edit file

  • x → run file

For directories:

  • r → list files

  • w → add/delete files

  • x → enter directory


Changing Permissions with chmod

Using Symbolic Mode

chmod u+x file.sh      # add execute to owner
chmod g-w file.txt     # remove write from group
chmod o+r file.txt     # add read to others

Using Numeric Mode

Numbers:

  • r = 4

  • w = 2

  • x = 1

Example:

chmod 755 script.sh

Meaning:

  • Owner: 7 → rwx

  • Group: 5 → r-x

  • Others: 5 → r-x


Changing Owner and Group

Use chown:

chown user file.txt
chown user:group file.txt

Special Permissions

SUID (Set User ID)

chmod u+s file

File runs with owner’s permissions.


SGID (Set Group ID)

chmod g+s dir

Files inside inherit group.


Sticky Bit

chmod +t /shared

Only file owner can delete files.


Common Permission Examples

CommandMeaning
chmod 644 file.txtOwner read/write, others read
chmod 700 privateOnly owner access
chmod 777 fileEveryone full access (not recommended)

Why File Permissions Matter

File permissions:

  • Protect sensitive data

  • Prevent unauthorized access

  • Control program execution

  • Improve system security

Wrong permissions can lead to data loss or hacking.


Conclusion

Understanding file permissions in Linux is essential for every user and administrator. Permissions define who can read, write, or execute files and directories. By learning commands like ls, chmod, and chown, you can manage security and access effectively in any Linux system.

Comments

Popular posts from this blog

How to Improve Node.js Performance (100% Working Techniques)

How to Improve Node.js Performance (100% Working Techniques) Optimize Express.js for Speed, Security & SEO Node.js is known for its high performance, but improper configuration can significantly slow down your application. In this article, you’ll learn proven and production-ready techniques to optimize Node.js performance, improve server response time, and boost SEO rankings. Why Node.js Performance Matters for SEO Google ranking heavily depends on: Server Response Time (TTFB) Page Speed Security Headers Reduced Server Load A slow Node.js backend directly affects: SEO ranking User experience Crawl budget 1. Disable x-powered-by Header Default Behavior Express exposes the following header: X-Powered-By: Express This reveals your backend technology and slightly increases response size. Best Practice app.disable('x-powered-by'); Benefits Improves security Reduces header size Prevents fingerprinting Recommended by OWASP 2. Use Weak ETag for Better Performance Problem with Def...

Top 10 Linux File System Basics – A Complete for Beginners

  Top 10 Linux File System Basics -Introduction The Linux file system is the backbone of how Linux operating systems store, organize, and manage data. Whether you are a Linux beginner, system administrator, DevOps engineer, or developer , understanding Linux file system basics is essential for efficient system management and security. we will cover the top 10 Linux file system basics with simple explanations, examples, and real-world use cases. 1. Everything Is a File in Linux One of the most important Linux file system principles is that everything is treated as a file —including: Regular files Directories Devices Processes Examples: /etc/passwd → user data file /dev/sda → disk device /proc/cpuinfo → CPU information This design makes Linux powerful and flexible. 2. Linux Directory Structure (Filesystem Hierarchy) Linux follows a standard directory layout called the Filesystem Hierarchy Standard (FHS) . Key directories: Directory Purpose / Root directory /bin Essential binarie...

Building Multi-Agent Systems: Practical Tutorial for 2026

Building Multi-Agent Systems: Practical Tutorial for 2026 Introduction Multi-Agent Systems (MAS) are becoming one of the most powerful architectures in modern AI. In 2026, they are widely used in automation, trading bots, robotics, distributed AI, smart cities, and enterprise AI systems. Instead of relying on one large AI model, multi-agent systems use multiple intelligent agents that collaborate, compete, or coordinate to solve complex problems. This tutorial explains how to build multi-agent systems from scratch in a practical and beginner-friendly way. What is a Multi-Agent System? A Multi-Agent System (MAS) consists of multiple autonomous AI agents that: Perceive the environment Make decisions independently Communicate with other agents Work toward shared or individual goals Each agent has its own role, memory, and reasoning capability. Experts from IBM, Google Cloud, Gartner, Deloitte, and others are calling 2026 the "year of multi-agent systems" and "multi-agent o...