Mission 13 of 30

Ownership and Groups Without Fear

Explain who owns a file and when ownership changes require care.

Learn users, groups, ownership, and why admin ownership commands are optional rather than required.

35–45 min Week 2 · Search, text, permissions, processes Ubuntu terminal
Your outcome: You understand who owns a file without needing to create or delete real users.
Practice inside ~/linux-practice. Check your setup before you begin. Prerequisite: File Permissions Deep Dive .

What you’ll practice

  • Inspect user identity
  • Read ownership columns
  • Recognize admin-only ownership commands

The mental model

  • Every file has an owner and group.
  • Your regular account should own practice files.
  • sudo changes the risk level.

Try it in your terminal

Who am I?

Read-only system view

Shows your username, IDs, and groups.

Run from ~/linux-practice

cd ~/linux-practice
whoami
id
groups

Inspect ownership

Read-only system view

Shows ownership on your file and reads user/group databases.

Run from ~/linux-practice

touch owned-by-me.txt
ls -l owned-by-me.txt
head -5 /etc/passwd
head -5 /etc/group

Optional admin ownership examples

Optional admin

These change real system state. They are explained, not required for this safe course.

Run from advanced users only

sudo chown username:groupname file.txt
sudo adduser testlearner
sudo userdel -r testlearner

Put it into practice

  1. Use ls -l and identify owner and group columns.
  2. Use id and identify your primary group.

Check your result

id and ls -l explain current ownership.

Common mistakes

  • A tutorial says 'run this with sudo' and you type it without thinking. Stop. Read the command. Ask yourself: 'Do I actually need admin rights for this?' Most beginner tasks don't. Running `sudo` because someone else's blog post said so is how you accidentally change ownership of system files and create problems you can't easily fix.
  • You see a file owned by 'root' and decide to `chown` it to yourself. That file is probably owned by root for a reason — maybe it's a system config or a package file. Changing ownership on files you didn't create is a good way to break things. Inspect first with `ls -l`. Understand why it's owned by root before touching it.

Check your understanding

Explain these in your own words. If you’re unsure, revisit the examples before moving on.

  1. Which command shows your user and group IDs?
  2. Why are adduser/userdel not part of the core safe path?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.