LAB-PERM-02 - UGO and the chmod Command
UGO and the chmod Command
Use symbolic chmod safely to add or remove specific permissions in a practice folder without overwriting everything.
- Add or remove a specific permission using symbolic chmod.
- Explain the difference between +, -, and = in chmod.
- Practice only in a disposable folder so mistakes are easy to undo.
Part A: The Field Guide
Symbolic chmod is useful when you want to change one part of the permission state without replacing everything.
The structure is:
chmod [who][operator][what] file
Examples:
u+xadd execute for the ownerg-wremove write from the groupo=remove all permissions for others
The main pieces
uownerggroupootheraall
Operators:
+add-remove=replace that target’s permissions exactly
Safe Default
When you only want to make a small change, prefer + or -. Use = when you truly mean to replace the full target state.
Part B: The Drill Deck
Terminal required: create a sandbox and keep all changes there.
G Guided Step by step - type exactly this and compare the result >
Exercise G1: Build the sandbox
mkdir -p ~/perm_lab cd ~/perm_lab touch test.txt ls -l test.txt
Exercise G2: Add one permission
- Run
chmod u+x test.txt - Run
ls -l test.txt - Explain exactly what changed and who it affected
Exercise G3: Remove one permission
- Run
chmod g-w test.txt - Run
ls -l test.txt - Explain exactly what changed and who it affected
Exercise G4: Replace one target
- Run
chmod o= test.txt - Run
ls -l test.txt - Explain why
o=is stronger thano-w
S Solo Task described, hints available - figure it out >
Exercise S1: Predict before running
Starting from -rw-r--r--, predict the result of each command:
chmod u+x file.txtchmod g-w file.txtchmod o= file.txt
Then test your predictions in the sandbox.
Exercise S2: One-line reasoning
Write one sentence for each operator:
- what
+is for - what
-is for - what
=is for
M Mission Real scenario - no hints, combine multiple skills >
Mission M1: Secure one private file
In your sandbox:
- create a file called
private.txt - use symbolic chmod to give the owner read and write
- remove all permissions from group and other
- verify the final string with
ls -l
If you can do that without defaulting to 777 or guessing, the symbolic model is working.