Racks of weapons line the walls. Suits of armour stand at attention. But every sword and potion is locked behind a permission barrier β€” you must learn chmod before you can equip a single item.

🎯 Quest Objectives

�️ Quest Prerequisites

⚑ Command Cheatsheet

Command What It Does
ls -l Long listing β€” shows permissions, owner, size
chmod +x file Add execute permission for everyone
chmod 755 file rwxr-xr-x β€” owner can all; others can read+execute
chmod 644 file rw-r--r-- β€” owner can read+write; others read only
./script Execute a script in the current directory

Permission String Decoder

-rwxr-xr-x
β”‚β””β”€β”€β”˜β””β”€β”€β”˜β””β”€β”€β”˜
β”‚ u   g   o
β”‚ user group others
└── file type: - = regular, d = dir, l = link

Each group: r = read (4), w = write (2), x = execute (1)

Octal shorthand: 755 = rwx r-x r-x, 644 = rw- r-- r--

πŸ—ΊοΈ Walkthrough

Step 1 β€” Inspect the armoury

ls -l
# -rw-r--r-- 1 user group  512 Jan 01 potion
# -rw-r--r-- 1 user group 1024 Jan 01 sword
# -rwxr-xr-x 1 user group  256 Jan 01 guardian*

potion and sword lack the x bit β€” they are not yet executable. You cannot run them.

Step 2 β€” Try running a locked script

./potion
# bash: ./potion: Permission denied

This is the expected result. Now fix it.

Step 3 β€” Grant execute permission

chmod +x potion
chmod +x sword
ls -l potion sword
# -rwxr-xr-x 1 user group 512 Jan 01 potion*
# -rwxr-xr-x 1 user group 1024 Jan 01 sword*

Step 4 β€” Drink the potion

./potion
# HP restored: 50 β†’ 100

Step 5 β€” Pick up the sword

./sword
# Sword of Echoes added to inventory.

Step 6 β€” Face the guardian

./guardian
# A stone golem steps forward...
# You raise your sword...
# [combat sequence]

With the sword equipped, you should win. Health permitting, the guardian falls and the door to the Chamber opens.

πŸ’‘ Understanding Octal Permissions

Octal Symbolic Who Can Do What
777 rwxrwxrwx Everyone can read, write, execute ⚠️
755 rwxr-xr-x Owner: all; others: read + execute βœ…
644 rw-r--r-- Owner: read + write; others: read only βœ…
600 rw------- Owner only β€” private files πŸ”’
400 r-------- Read-only, even for owner

Security note: Never use chmod 777 on scripts or sensitive files. Use 755 for scripts and 644 for data.

πŸ’‘ Common Pitfalls

Problem Cause Fix
Permission denied after chmod Not the file owner Use ls -l to check owner
Script does nothing Missing shebang line Add #!/usr/bin/env bash as line 1
No such file: ./sword Wrong directory pwd and ls first
Health still low after potion Bug in game version Run ./setup.sh --repair

βœ… Validation

➑️ Next Steps


πŸ“š External Resources

Continue your terminal adventure with these resources:


Sword in hand, potion consumed. The Chamber awaits. βš”οΈ