DEV Community

Cover image for Day 4: Linux File System Explained β€” Why Every Directory Is a Hacker's Treasure Map
Mr Elite
Mr Elite

Posted on • Originally published at securityelites.com

Day 4: Linux File System Explained β€” Why Every Directory Is a Hacker's Treasure Map

πŸ“° Originally published on SecurityElites β€” the canonical, fully-updated version of this article.

Day 4: Linux File System Explained β€” Why Every Directory Is a Hacker's Treasure Map

DAY 4 OF 100
100-Day Ethical Hacking Course

Full Course β†’

πŸ”΄ Day 4 β€” Linux File System for Hackers

Day 100 β€” Professional Pentester

← Day 3: Linux Commands

Day 5: Networking Basics β†’

04

When I first gained access to a Linux system during a penetration test, the first thing I did wasn’t run a fancy exploit. I typed ls / and looked at the directories. Because once you know where everything lives, the system tells you everything you need to know.

The Linux filesystem is not random. It follows a standard called the FHS (Filesystem Hierarchy Standard). Every directory has a specific purpose. Every sensitive file has a predictable location. Today you learn to read that map.

This lesson has two audiences and both of them are you β€” the student and the future professional. As a student, you need to navigate Kali comfortably and understand where your tools, configs, and files live. As a penetration tester, you need to know exactly where to look when you land on an unfamiliar Linux system. Same knowledge, two applications. Let’s build it.

πŸ“‹ Day 4 Contents

  1. The FHS β€” Linux’s Master Plan
  2. The Root-Level Directories
  3. /etc β€” Configuration Files
  4. /home β€” User Directories
  5. /var β€” Logs & Variable Data
  6. /tmp β€” World-Writable Territory
  7. /proc β€” The Live System Window
  8. /usr, /bin, /sbin β€” Programs
  9. The Most Sensitive Files on Linux
  10. Day 4 Practical Task

The FHS β€” Linux’s Master Plan

Linux systems follow the Filesystem Hierarchy Standard (FHS) β€” an agreed-upon structure that defines where different types of files should live. This is why a file you find in /etc on an Ubuntu server, a Kali VM, and a Raspberry Pi all behave the same way. The standard applies across almost all Linux distributions.

Everything in Linux starts at / β€” called β€œroot” (not to be confused with the root user). It’s the top of the directory tree. Every single file on a Linux system β€” regardless of what physical disk or partition it’s on β€” exists somewhere under /. There are no drive letters like Windows. One tree. Everything in it.

Linux Filesystem Tree β€” run: tree -L 1 /

/
β”œβ”€β”€ etc ← System configuration files
β”œβ”€β”€ home ← User home directories
β”œβ”€β”€ var ← Logs, databases, mail, web data
β”œβ”€β”€ tmp ← Temporary files β€” world-writable
β”œβ”€β”€ proc ← Virtual filesystem β€” live kernel data
β”œβ”€β”€ usr ← User programs, libraries, docs
β”œβ”€β”€ bin ← Essential binaries (ls, cp, cat…)
β”œβ”€β”€ sbin ← System binaries (for root/admin)
β”œβ”€β”€ lib ← Shared libraries for /bin and /sbin
β”œβ”€β”€ root ← Home directory for root user
β”œβ”€β”€ dev ← Device files (disks, terminals, etc.)
β”œβ”€β”€ mnt ← Mount points for external drives
β”œβ”€β”€ opt ← Optional/third-party software
β”œβ”€β”€ boot ← Bootloader, kernel images
└── sys ← Virtual filesystem β€” hardware info

Colour guide: red = critical config Β |Β  green = user data Β |Β  yellow = logs/variable Β |Β  purple = world-writable Β |Β  blue = live kernel data

Root-Level Directories β€” What Each One Does

Before we go deep into the most important directories, here is a clean reference for every root-level folder. I want you to understand the purpose of each one β€” not memorise the tree, but know instinctively where to look for any type of file.

Directory
Purpose
Security Relevance

/etc
System-wide configuration files
πŸ”΄ Highest β€” credentials, users, services

/home
User home folders (/home/username)
🟑 High β€” SSH keys, browser data, files

/var
Variable data β€” logs, databases, web
🟑 High β€” logs reveal activity, web files

/tmp
Temporary files β€” world-writable
🟣 Medium β€” tool upload staging area

/proc
Live kernel/process data (virtual)
πŸ”΅ Medium β€” enumerate processes, network

/root
Home directory of the root user
πŸ”΄ Critical β€” root’s files, history, keys

/usr
User programs and libraries
πŸ”˜ Low β€” installed tools, exploits here

/bin
Essential user binaries (ls, cat, cp)
πŸ”˜ Low β€” SUID check on these

/sbin
System admin binaries (root tools)
πŸ”˜ Low β€” check for unusual binaries

/dev
Device files (disks, terminals, null)
πŸ”˜ Low β€” /dev/null, /dev/random useful

/boot
Kernel and bootloader files
πŸ”˜ Low β€” kernel version fingerprinting

/opt
Optional third-party software
πŸ”˜ Low β€” sometimes holds custom apps

/etc Configuration Files β€” The Brain of the System

/etc stands for β€œet cetera” historically, but in practice it means system configuration. Almost every service, program, and system setting on a Linux machine is controlled by a plain text file somewhere in /etc. This is the first directory I check on any new system β€” it tells me everything about what’s running and how it’s configured.

Critical files in /etc β€” explore these in your Kali VM

User accounts β€” who exists on this system?

cat /etc/passwd
root❌0:0:root:/root:/bin/bash
kali❌1000:1000:Kali:/home/kali:/bin/bash

Format: username:password(x):UID:GID:comment:home:shell

β€œx” means password is in /etc/shadow

Password hashes β€” ROOT ACCESS REQUIRED

sudo cat /etc/shadow
root:$6$xyz…:19000:0:99999:7:::

Format: username#️⃣last_change:min:max:warn:…

$6$ = SHA-512 hash β€” if you capture this, you can crack it offline

Groups β€” who belongs to which group?

cat /etc/group
sudo❌27:kali ← kali user is in the sudo group (admin access)

Hostname resolution β€” local DNS overrides

cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 kali

Attackers sometimes modify /etc/hosts to redirect traffic

Scheduled tasks running as root

cat /etc/crontab
ls /etc/cron.d/
ls /etc/cron.daily/

Every script here runs automatically β€” check for writable scripts!

SSH server configuration

cat /etc/ssh/sshd_config
PermitRootLogin yes ← This is a serious misconfiguration
PasswordAuthentication yes ← Allows password brute force

Network interfaces β€” static IP configuration

cat /etc/network/interfaces
cat /etc/resolv.conf # DNS servers configured


πŸ“– Read the complete guide on SecurityElites

This article continues with deeper technical detail, screenshots, code samples, and an interactive lab walk-through. Read the full article on SecurityElites β†’


This article was originally written and published by the SecurityElites team. For more cybersecurity tutorials, ethical hacking guides, and CTF walk-throughs, visit SecurityElites.

Top comments (0)