Lab Complete!

You mastered chmod and file permissions.

LABS / linux file permissions
BEGINNER+
Tasks
Why permissions exist

Linux is multi-user by design. Permissions decide who can read, write, or run each file, so one user's files stay private from everyone else unless they choose to share them.

Think of a filing cabinet: Every drawer has a lock. The permission string says who holds a key: you, your team, or anyone in the building.
Reading a permission string

ls -l shows a 10-character string like -rwxr-xr--. It breaks into four parts:

-rwxr-xr--
-rwxr-xr--
typeownergroupother
PositionMeaning
1st char- = file, d = directory, l = symlink
Next 3Owner's read/write/execute
Next 3Group's read/write/execute
Last 3Everyone else's read/write/execute

r = read, w = write, x = execute (run a program, or enter a directory). A - means that permission is missing.

Numbers instead of letters

Each permission has a value: read = 4, write = 2, execute = 1. Add them up per group to get one digit:

rwx = 4+2+1 = 7 rw- = 4+2 = 6 r-x = 4+1 = 5 r-- = 4 = 4 --- = 0 = 0

So rwxr-xr-- becomes 754 — one digit each for owner, group, other.

Changing permissions
chmod 644 file.txt # numeric: rw-r--r-- chmod 755 script.sh # numeric: rwxr-xr-x chmod u+r file.txt # symbolic: add read for owner chmod +x script.sh # add execute for everyone chmod o-r secret.txt # remove read for others

Symbolic mode uses u (user/owner), g (group), o (other), a (all), with +/- to add or remove a permission.

Only the owner (or root) can chmod a file. Setting permissions too open, like 777, lets anyone read, write or run it — avoid that on real systems.
Mission: Your home directory has a file you locked yourself out of, and a script that won't run. Fix both.
1
Inspect permissions
Run ls -l and read the permission string on flag.txt and deploy.sh.
2
Try reading the locked file
Run cat flag.txt. It should be denied — note which permission is missing.
3
Grant yourself read access
Use chmod (numeric or symbolic) to give the owner read permission, then cat it again.
4
Make the script runnable
Add execute permission to deploy.sh so ./deploy.sh runs instead of being denied. Submit the flag you uncover.
Try first, then peek. Hints nudge you without the exact answer.
The first three letters after the type character are the owner's permissions. A missing r shown as - means the owner cannot read it.
To give the owner read+write (no execute), use 600. Read = 4, write = 2, so 4+2 = 6 for the owner's digit.
chmod u+r file adds read for the owner without touching anything else.
Even with read permission, a script needs the execute bit to run: chmod +x deploy.sh, then run it with ./deploy.sh.
Stuck after trying? Reveal the walkthrough.
alice@lab-server: ~
alice@lab:~$
Live Command Breakdown
Start typing a command to see what each part does...
Waiting for input
Common chmod numbers
NumberMeaning
700Owner: full control. No one else, anything.
600Owner: read/write only. Common for private files.
644Owner: read/write. Everyone else: read only.
755Owner: full. Everyone else: read + execute. Common for scripts.
777Everyone: full control. Avoid this.