Linux File Permissions, Decoded

Linux uses file permissions to control who can read, modify, or execute files.

This is an important part of Linux security because it prevents users and programs from accessing files they should not be able to use.

The Three Basic Permissions

Linux commonly uses three basic permissions:

PermissionSymbolMeaning
ReadrView the contents
WritewModify the contents
ExecutexRun the file

For example:

rwx

means:

  • r → read
  • w → write
  • x → execute

Who Gets These Permissions?

Linux divides permissions into three groups:

Owner — the user who owns the file.

Group — users belonging to the file’s group.

Others — everyone else.

You might see something like:

-rwxr-xr--

Break it down like this:

- rwx r-x r--
  │   │   │
  │   │   └── Others
  │   └────── Group
  └────────── Owner

The owner can read, write, and execute.

The group can read and execute.

Others can only read.

Checking Permissions

On Linux, use:

ls -l

You might see:

-rw-r--r-- 1 user user 1200 notes.txt

The permission section is:

-rw-r--r--

This tells you who can access the file and what they can do with it.

Changing Permissions

Linux provides the chmod command for changing permissions.

For example:

chmod 600 secret.txt

This gives the owner read and write permissions while removing permissions for the group and everyone else.

Be careful when changing permissions, especially with system files.

Why Do Permissions Matter?

Imagine a server containing:

passwords.txt
database.conf
website/

If sensitive files are readable by everyone, an unauthorized user may be able to access information they should never see.

Correct permissions help reduce this risk.

Key Takeaways

  • Linux uses permissions to control file access.
  • r means read.
  • w means write.
  • x means execute.
  • Permissions apply to the owner, group, and others.
  • ls -l lets you view permissions.
  • chmod can change permissions.

Try It Yourself

Create a practice file in your own Linux virtual machine:

touch practice.txt

Then check its permissions:

ls -l practice.txt

Experiment with changing its permissions using chmod, and then run ls -l again to see what changed.

Use a virtual machine or practice environment, especially while you’re learning.

Similar Posts

  • Password strength checker

    The goal I wanted a small tool that tells you how weak or strong a password is, and explains why, not just gives a pass or fail. What you need Python 3, and about two hours if you’re new to it. How I built it The checker scores a password out of 5, based on…

  • Cross-Site Scripting, Explained With One Example

    Cross-Site Scripting (XSS) is a web security vulnerability that happens when a website places untrusted user input into a webpage without properly handling it. In simple terms: The website expects data, but the browser ends up treating that data as code or markup. A Simple Example Imagine a website has a comment box: A normal…

Leave a Reply

Your email address will not be published. Required fields are marked *