Practice Use drills for recall and labs for real operating judgment.

LAB-PERM-04 - Ownership and chown

Understand file ownership and group association, and practice safe chown reasoning in a sandbox or disposable system.

ACL Permission Management

Ownership and chown

Understand file ownership and group association, and practice safe chown reasoning in a sandbox or disposable system.

30 min INTERMEDIATE LINUX Curriculum-reviewed
Success criteria
  • Explain the difference between ownership and permissions.
  • Recognize basic chown and chgrp syntax.
Safety notes
  • Only use sudo chown on disposable files or a training system. Ownership mistakes on real data can be disruptive.

Part A: The Field Guide

Permissions answer what the owner, group, and others may do. Ownership answers who the owner and group are in the first place.

Those are related, but they are not the same thing.

A typical ls -l line includes both:

-rw-r--r-- 1 alice developers 42 Jan 1 notes.txt

In that example:

  • alice is the owner
  • developers is the group

chmod changes the allowed actions. chown changes the owner and or group.

Safety Rule

Changing ownership is a real administrative action. Practice the syntax and reasoning first, then use it carefully on disposable files or a training system.

Common syntax

  • sudo chown alice file.txt
  • sudo chown alice:developers file.txt
  • sudo chown :developers file.txt
  • sudo chgrp developers file.txt

Part B: The Drill Deck

Terminal required: if you do not have sudo access, still complete the reasoning tasks. The concepts matter even before you run the command yourself.

G
Guided Step by step - type exactly this and compare the result
>

Exercise G1: Inspect ownership

  1. Run mkdir -p ~/perm_lab && cd ~/perm_lab
  2. Run touch owned.txt
  3. Run ls -l owned.txt
  4. Identify the owner and group fields

Exercise G2: Read chown syntax

Explain what each command would do:

  1. sudo chown alice file.txt
  2. sudo chown alice:developers file.txt
  3. sudo chown :developers file.txt

Exercise G3: Optional practice on a disposable file

If you have sudo access on a safe training machine:

Optional ownership practice

cd ~/perm_lab touch handoff.txt ls -l handoff.txt sudo chown root handoff.txt ls -l handoff.txt sudo chown $USER: handoff.txt ls -l handoff.txt

If you do not have sudo, skip the command execution and focus on understanding what each step means.

S
Solo Task described, hints available - figure it out
>

Exercise S1: Ownership versus permission

Answer in one or two sentences each:

  1. What does changing ownership do that chmod does not do?
  2. Why might a service file need to belong to a service account instead of a human user?

Exercise S2: Syntax writing

Write the exact command you would use for each case:

  1. change only the group to auditors
  2. change owner to nginx and group to www-data
  3. change owner to your current user and the group to your primary group
M
Mission Real scenario - no hints, combine multiple skills
>

Mission M1: Plan a handoff

A file currently belongs to a developer account, but now a service should own it.

Explain:

  1. why changing only chmod may not be enough
  2. what ownership change you would likely consider
  3. why this should be tested on disposable data first

If you can reason through that, you are understanding ownership as part of system design instead of as a random command.