File System & Permissions
Linux's permission system is both a security feature and a common source of privilege escalation vulnerabilities. You will learn how file ownership, read/write/execute permissions, and special bits like SUID work, and why misconfigurations in these settings are frequently exploited by attackers. Understanding permissions is essential for both hardening systems and finding weaknesses in them.
Learning Objectives — Deep Dive
Each objective below is broken down into plain English so you know exactly what you are learning, why it matters, and what you will be able to do when you are done. Mark each one complete as you work through the lesson.
Examine file permissions
Run 'ls -la /etc/passwd /etc/shadow /etc/sudoers' to see the permission bits on critical system files. The output shows permissions in the format '-rw-r--r--' where the first character is the file type, the next three are owner permissions (read/write/execute), the next three are group permissions, and the last three are world permissions. The /etc/shadow file should show '---------- 1 root shadow' — readable only by root and the shadow group. A misconfigured /etc/shadow that is world-readable is a critical finding because it exposes password hashes to any local user.
Create a file and set permissions
Run 'touch testfile.txt' to create an empty file, then 'chmod 600 testfile.txt' to set it so only the owner can read and write it. The chmod command accepts either octal notation (600 = rw-------) or symbolic notation (chmod u=rw,go= testfile.txt). Practice with common permission sets: 755 (rwxr-xr-x) for executable scripts, 644 (rw-r--r--) for regular files, and 700 (rwx------) for private directories. Run 'ls -la testfile.txt' after each chmod to verify the permissions changed correctly.
touch testfile.txt && chmod 600 testfile.txt && ls -la testfile.txtFind SUID binaries
Run 'find / -perm -4000 -type f 2>/dev/null' to enumerate all SUID binaries, then cross-reference each result against GTFOBins at gtfobins.github.io. GTFOBins documents how legitimate Unix binaries can be abused to escalate privileges, escape restricted shells, or read/write files outside their intended purpose. Common SUID binaries that appear on GTFOBins include find, vim, python, nmap, and bash. A non-standard SUID binary in /tmp or a user's home directory is a strong indicator of a previously planted backdoor.
find / -perm -4000 -type f 2>/dev/nullFind world-writable files
Run 'find / -perm -002 -type f 2>/dev/null' to find all world-writable files — files that any user on the system can modify. World-writable scripts that are executed by cron jobs or other privileged processes are a classic privilege escalation vector: if you can write to a script that root runs, you can inject malicious commands. Also run 'find / -perm -002 -type d 2>/dev/null' to find world-writable directories, which allow any user to create or delete files within them. Document every world-writable file owned by root as a potential finding.
find / -perm -002 -type f 2>/dev/null