Systems CourseC/C++ · Linux · Memory
LinuxLesson 31 of 441 min read6 questions

chown & Ownership

Change owner/group; only root can give a file away.

Test yourself ↓

Concept core idea Watch out easy to get wrong

Concept

Key concepts

  1. chown user file, chown user:group file, chown :group file (group only); -R = recursive. chgrp group file changes only the group.
  2. Only root (sudo) can change a file's owner — a regular user can't give their file away or take another's. The owner CAN change the group to one they belong to.
  3. Ownership + rwx triplets together gate access: a process's UID/GID is checked against owner/group/other bits on every open/read/write.
  4. id = your UID/GID/groups; whoami = your username.
  5. Systems relevance: deploying a service = chown binary/data to a service user; setuid / privilege-dropping daemons rely on ownership.
Watch out

Easily confused

chown vs chgrp
chown changes owner (and optionally group); chgrp changes only the group.
id vs whoami
id shows your UID/GID and all groups; whoami shows just your username.

Test yourself

6 questions on this lesson. Write your answers from memory, then compare them with the model answers side by side.