← Back to list

Understanding File Permissions in Linux (r, w, x)

File permissions are one of the most important security features in Linux. They define who can access a file or directory and what actions…

Nakul Mitra in Towards Dev · 2026-02-14 08:30 · 3 claps · 2.8 min read
#linux #linux-permission #software-engineering #devops #software-development
Open on Medium ↗
Wiki topics: CRY · Crypto & Web3 ☁️ · DevOps & Cloud 🔓 · Open Source 🎬 · Film & Television

Understanding File Permissions in Linux (r, w, x)

File permissions are one of the most important security features in Linux. They define who can access a file or directory and what actions they are allowed to perform.

Every file and directory in Linux has:

  • An owner
  • A group
  • A set of permissions

These permissions control:

  • Who can read a file
  • Who can modify a file
  • Who can execute a file or enter a directory

Understanding this concept is mandatory for developers, DevOps engineers, and system administrators.

[embed]

Why File Permissions Matter

Linux is a multi-user operating system. Multiple users can work on the same machine at the same time. Without permissions:

  • Any user could modify system files
  • Any user could delete critical data
  • Any script could run without restrictions

File permissions provide:

  • Security
  • Isolation between users
  • Controlled access to system resources

The Three Permission Types

Linux uses three basic permission types:

Viewing File Permissions

To view permissions, use:

ls -l

Example output:

-rwxr-xr-- 1 nakul users 1024 notes.txt

This single line contains all permission information.

Understanding Permission Format

Let’s break this down:

-rwxr-xr--

1. First Character — File Type

Example:

drwxr-xr-x

This means it is a directory.

2. Next 9 Characters — Permissions

These are divided into three groups of three:

rwx | r-x | r--

Real Meaning Example

Permission string:

rwxr-xr--

Means:

File vs Directory Permissions (Important Concept)

For Files

For Directories

This is why sometimes:

  • We can see a directory but cannot enter it
  • We can enter but cannot create files

Common Developer Problem: Permission Denied

Example:

./deploy.sh

Error:

Permission denied

Reason: The script does not have execute permission. Linux will never run a file unless x is set.

Typical Permission Patterns

Mental Model (Very Useful)

Think of permissions like, linux asks three questions.

  1. Is the user the owner?
  2. Else, is the user in the group?
  3. Else, treat as others

And then checks:

  • Can they read?
  • Can they write?
  • Can they execute?

Why Developers Must Understand This

As a developer, file permissions affect:

  • Running scripts
  • Deploying applications
  • Reading config files
  • Accessing logs
  • Docker volumes
  • CI/CD pipelines
  • SSH access
  • Production servers

Most real-world Linux errors come from Incorrect permissions, not broken code.

Real Production Example

Spring Boot app fails to start:

./start.sh
Permission denied

Fix: The script exists, but execute permission missing. This is not a Java problem. This is a Linux permission problem.

Key Takeaways

  • Linux permissions are fundamental to security
  • Every file has owner, group, others
  • Every entity has r, w, x permissions
  • ls -l is our first debugging tool
  • Most Permission denied issues are solved by understanding this topic

메타데이터
post_id
758ccd3edc2f
slug
understanding-file-permissions-in-linux-r-w-x-758ccd3edc2f
url
https://towardsdev.com/understanding-file-permissions-in-linux-r-w-x-758ccd3edc2f
canonical_url
https://towardsdev.com/understanding-file-permissions-in-linux-r-w-x-758ccd3edc2f
author_url
https://medium.com/@nakulmitra2114
status
ok
fetched_at
2026-06-13 07:35:29