RedTeam Nexus Labs
Module 04 · Lesson 02 // Permissions

ownership

Permissions · Linux

Freereading · 10 min
On this page
LESSON

Overview

Permissions only make sense alongside ownership: every file has an owning user and an owning group, and which permission class applies to you depends on your relationship to those owners. This lesson explains file ownership.

Learning objectives

  • Explain user and group ownership of files.
  • Determine which permission class applies to a given user.
  • Read ownership from ls -l.

Core concept

Every file and directory has:

  • A user owner — usually the account that created it.
  • A group owner — a group associated with the file.

When someone accesses a file, Linux picks the most specific applicable class: if you are the owner, the owner permissions apply; else if you are a member of the file's group, the group permissions apply; otherwise the other permissions apply. Only one class governs your access — they are not additive.

How it works

ls -l displays the owner and group between the permission string and the size. The kernel compares the acting user's identity to the file's owners: are you the user owner? If yes, owner permissions decide, and group/other are ignored for you. If not but you are in the file's group, group permissions decide. Failing both, other permissions apply. This is why the owner class is checked first and is the most specific.

Practical example

$ ls -l report.txt
-rw-r----- 1 alice devs 2048 Sep 21 10:00 report.txt

Owner alice, group devs. Alice (owner) gets rw- (read/write). A member of devs who is not Alice gets r-- (read only). Anyone else gets --- (no access). Note that even if the "other" class were more permissive, Alice would still be governed solely by the owner class because that is the most specific match.

Cybersecurity relevance

Ownership determines who effectively controls a file. Misassigned ownership — a sensitive file owned by the wrong user or group, or a config file writable by its group when it should not be — can grant unintended control and enable tampering or escalation. During assessment, checking who owns key files (and whether that owner is appropriate) is as important as checking the permission bits. Correct ownership plus least-privilege permissions is what keeps files properly confined.

Common mistakes

  • Assuming permissions add up across classes — only the single most specific class applies to you.
  • Ignoring the group owner, which governs access for group members.
  • Overlooking wrong ownership on sensitive files, which can silently grant control.

Key takeaways

  • Every file has a user owner and a group owner, shown in ls -l.
  • Access is decided by the single most specific class: owner if you own it, else group if you are a member, else other.
  • Correct ownership is as important as correct permission bits; misassigned ownership can grant unintended control.

Check your understanding

  • If you are the owner of a file but the "other" class has broader permissions, which class governs your access?
  • Why is checking file ownership, not just the permission bits, important during a security review?
FINISH THIS LESSON

Sign in to save your progress.