Linux is a multi-user operating system. A username and UID identify each user; groups have GIDs. A user has one primary group and may join supplementary groups to access shared resources. whoami prints the current user, while id shows the UID, GID, and group memberships.
Owner, group, and three permission sets
In -rw-r--r-- 1 alice developers 1536 ... notes.txt from ls -l, alice is the owner, developers is the group, and the first ten characters encode the file type and permissions. Permissions are split into user, group, and others.
r · 4file: read; directory: list entries
w · 2file: modify; directory: create/delete entries
x · 1file: execute; directory: enter/access entries
Permission anatomy
- | rwx | r-x | r-- user group other 7 5 4
Change permissions with chmod
Symbolic mode states the change precisely: chmod u+x backup.sh adds execute for the owner, chmod g+w shared.txt adds group write, and chmod o-r private.txt removes read from others. The targets are u, g, o, and a.
Numeric mode adds r=4, w=2, and x=1. chmod 755 script.sh means rwxr-xr-x; chmod 644 notes.txt means rw-r--r--. Do not use these numbers blindly—or open permissions more than the task requires.
Change owner and group
sudo chown bob report.txt changes the owner, sudo chown bob:developers report.txt changes owner and group, and chgrp developers report.txt changes only the group. Groups are the controllable way to share resources on multi-user systems.
Permission Scenario Decoder
KNOWLEDGE QUIZ
KNOWLEDGE QUIZ
Prepare a Team Deployment Directory
Set explicit least-privilege modes and ownership for deploy.sh and settings.conf on a lab machine.
- Inspect your identity, groups, and both files' current modes.
- Give the deploy.sh owner rwx, developers group r-x, and others no access.
- Make settings.conf readable/writable by its owner only.
- Change both files' group to developers and verify again.