01
Linux
8 lessons · the operator's daily environment
L1The shell & navigation
The shell is a text interface to the kernel: you type a command, it runs a program. Almost everything on Linux is reachable this way, which is why operators live here.
$ pwd # where am I?
$ ls -la /etc # list all, long format
$ cd /var/log && ls
$ man ls # the manual is the source of truth
- Tab-completion and
history save more time than any trick.
man <cmd> and <cmd> --help beat memorizing flags.
- Commands run with your privileges — understand them before running as root.
Go deeper Linux Journey · OverTheWire Bandit (learn by playing)
L2Filesystem & paths
Linux has one tree rooted at /. Knowing the standard layout (FHS) tells you where configuration, logs, and user data live before you ever search.
$ cat /etc/os-release # which distro?
$ df -h # disk space per mount
$ ls /etc /var /home /tmp
/etc config, /var/log logs, /home users, /tmp world-writable scratch.
- Absolute paths start at
/; relative paths start where you are.
- World-writable dirs like
/tmp are classic privilege-escalation territory.
Go deeper Linux Journey · Ubuntu tutorials
L3Permissions & ownership
Every file has an owner, a group, and three permission triplets (read/write/execute) for user, group, and others. The numeric form is just those triplets in octal.
$ ls -l secret.txt
-rw-r----- 1 yousef soc 42 Nov 30 02:00 secret.txt
$ chmod 640 secret.txt # rw- r-- ---
$ chown yousef:soc secret.txt
755 = rwxr-xr-x (dirs/executables), 644 = rw-r--r-- (plain files).
- Execute on a directory means "may enter/traverse", not "may run".
- SUID/SGID bits run a file as its owner — audit them with
find / -perm -4000.
Go deeper Linux Journey · Ryan's Linux tutorial
L4Users, groups & sudo
Identity lives in /etc/passwd (accounts), /etc/shadow (hashes, root-only), and /etc/group. sudo grants temporary elevation per policy in /etc/sudoers.
$ id # uid, gid, groups
$ sudo -l # what may I elevate to?
$ grep yousef /etc/passwd
- UID 0 is root; service accounts usually have nologin shells.
- Group membership is evaluated at login — re-login after changes.
- Misconfigured sudoers (NOPASSWD on editors, tar, vim) is a direct root path.
Go deeper Linux Journey · OverTheWire Bandit
L5Packages & services
Distributions ship software through package managers (apt on Debian/Ubuntu, dnf on Fedora/RHEL). Long-running programs are managed as systemd units.
$ sudo apt update && sudo apt install nmap
$ systemctl status ssh
$ sudo systemctl restart nginx
$ journalctl -u nginx -n 50 # last 50 log lines
enable = start at boot; start = start now. They are different.
journalctl is the first place to look when a service misbehaves.
- Only install from trusted repos — a package runs install scripts as root.
Go deeper Ubuntu tutorials · Linux Journey
L6Processes & signals
Every running program is a process with a PID and a parent. Signals are how you ask it to stop, reload, or die; jobs control lets you background work in the shell.
$ ps aux | grep nginx
$ top # live view, q to quit
$ kill -15 1234 # polite terminate
$ kill -9 1234 # force, last resort
$ sleep 100 & jobs # background + list
- SIGTERM (15) lets a process clean up; SIGKILL (9) cannot be caught.
- Zombies are dead children whose parent hasn't reaped them yet.
- Unexpected processes or odd parents are a hunting starting point.
Go deeper Linux Journey · Ryan's Linux tutorial
L7Pipes & text processing
Unix philosophy: small tools, composed with pipes. grep filters, cut/awk extract columns, sort | uniq -c counts — this chain answers most log questions.
$ grep -R "password" /etc 2>/dev/null
$ cat access.log | awk '{print $1}' | sort | uniq -c | sort -nr | head
$ sed -i 's/old/new/g' file.conf
- Redirects:
> overwrite, >> append, 2> stderr.
awk '{print $N}' splits on whitespace by default.
- The uniq -c chain above is a one-line "top talkers" analysis.
Go deeper The Linux Command Line (free book) · Linux Journey
L8Networking commands
Modern Linux uses ip and ss (the old ifconfig/netstat are deprecated). These four commands answer "what am I, who listens, who talks, where does it go".
$ ip a # interfaces + addresses
$ ip route # routing table
$ ss -tulpn # listening sockets + owning process
$ sudo tcpdump -i eth0 port 80 -nn
ss -tulpn maps open ports to PIDs — essential for triage.
ping tests reachability, traceroute shows the path.
- Capture only what you're authorized to capture; tcpdump needs root.
Go deeper Linux Journey · Cloudflare Learning Center
02
Networking
8 lessons · how packets actually move
N1Models & encapsulation
OSI's seven layers are a teaching vocabulary; TCP/IP's four are what runs. Data gains a header at each layer down the stack (encapsulation) and loses it going up.
# application data
# + TCP/UDP header -> segment (ports)
# + IP header -> packet (addresses)
# + Ethernet header -> frame (MACs)
$ traceroute example.com # watch layer 3 hop by hop
- Switches read MACs (L2), routers read IPs (L3), firewalls can read ports and payloads (L4–7).
- "It's a layer 8 problem" = the human/config, not the wire.
- Attacks map to layers: ARP spoofing L2, IP spoofing L3, SYN flood L4, SQLi L7.
Go deeper Cloudflare Learning Center · Cisco Skills for All (free)
N2IP & subnetting
An IPv4 address is 32 bits: network part + host part, split by the mask. CIDR /24 means 24 network bits, leaving 8 host bits = 254 usable addresses.
192.168.1.0/24
network 192.168.1.0
usable 192.168.1.1 - 192.168.1.254
broadcast 192.168.1.255
$ ipcalc 192.168.1.0/24
- Private ranges (RFC1918): 10/8, 172.16/12, 192.168/16.
- Each bit borrowed from hosts doubles subnets and halves their size.
- Wrong masks cause "half the network can't talk" outages — check them first.
Go deeper Cisco Skills for All · Practical Networking
N3MAC, ARP & switching
Inside one LAN, frames are delivered by MAC address. ARP resolves IP→MAC by broadcast; switches learn which MAC lives on which port and forward only there.
$ arp -a # IP-to-MAC cache
$ ip neigh # same, modern Linux
- VLANs split one physical switch into separate broadcast domains.
- Trunks carry multiple VLANs tagged (802.1Q) between switches.
- ARP has no authentication — spoofing it enables man-in-the-middle on a LAN.
Go deeper Practical Networking · Cisco Skills for All
N4Routing
Routers move packets between networks using a table of prefixes → next hop. The most specific matching prefix wins; a default route (0.0.0.0/0) catches everything else.
$ ip route
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link
$ traceroute -n 8.8.8.8
- Static routes are manual; OSPF/BGP exchange routes dynamically.
- Your gateway is just the next hop for anything off-subnet.
- Asymmetric or missing routes look exactly like "the firewall blocked it".
Go deeper Cisco Skills for All · Practical Networking
N5DNS & DHCP
DNS translates names to addresses through a chain: local cache → resolver → root → TLD → authoritative. DHCP hands out leases via Discover-Offer-Request-Ack (DORA).
$ nslookup example.com
$ dig +short MX example.com
$ cat /etc/resolv.conf # which resolver do I use?
- Records: A/AAAA (address), CNAME (alias), MX (mail), TXT (verification/SPF).
- TTL controls caching — changes propagate slowly by design.
- DNS is plaintext by default: poisoning and tunneling both abuse that.
Go deeper Cloudflare: What is DNS? · Cisco Skills for All
N6Ports & transport
TCP is connection-oriented (three-way handshake SYN→SYN/ACK→ACK, reliable, ordered); UDP is fire-and-forget (fast, used by DNS, VoIP, games). Ports identify the service on a host.
22 ssh 53 dns 80 http 443 https
445 smb 3389 rdp 3306 mysql 5432 postgres
$ ss -tulpn # who listens where
- 0–1023 are well-known; services can run anywhere though.
- A "closed" port sends RST; a filtered one silently drops — different scan results.
- Half-open (SYN) scans exploit the handshake to stay quiet.
Go deeper Cloudflare Learning Center · Practical Networking
N7Firewalls & NAT
A stateful firewall tracks connections and allows return traffic automatically. NAT rewrites addresses so many private hosts share one public IP (PAT overloads ports).
$ sudo iptables -L -n -v # rules + counters
$ sudo nft list ruleset # modern replacement
- Rule order matters: first match wins; end with an explicit deny.
- Stateful ≠ application-aware; a WAF inspects HTTP, a firewall inspects flows.
- NAT is not a security control — it hides addresses, it doesn't authenticate.
Go deeper Cloudflare Learning Center · Cisco Skills for All
N8Troubleshooting & capture
Work bottom-up: link → IP → route → DNS → port → application. Capture traffic when logs disagree with reality; filters keep captures readable.
$ ping 192.168.1.1 # L3 local
$ ping 8.8.8.8 # L3 internet
$ nslookup example.com # name resolution
$ sudo tcpdump -i eth0 'tcp port 443' -w cap.pcap
- If IP works but names fail, it's DNS — not "the internet".
- Wireshark filters:
ip.addr==x, tcp.flags.syn==1, dns.
- Beacons, scans, and exfil have recognizable capture signatures.
Go deeper Practical Networking · Cloudflare Learning Center
03
Windows
8 lessons · the enterprise endpoint
W1Editions & architecture
Windows NT family (10/11, Server) shares one kernel: user mode vs kernel mode, sessions per logon, and subsystems like Win32. Editions differ in features, not fundamentals.
C:\> systeminfo # OS, build, hotfixes, domain
C:\> winver # edition + build dialog
C:\> hostname & whoami
- Server adds roles (AD DS, DNS, DHCP); client adds desktop experience.
- Build number matters more than "Windows 10" for patch/bug questions.
- systeminfo's hotfix list is a quick patch-gap assessment.
Go deeper Microsoft Learn (free) · Windows docs
W2NTFS & access control
NTFS permissions are ACLs of allow/deny entries per principal; share permissions apply only over the network. Effective access is the intersection — the most restrictive wins.
C:\> icacls C:\Data
C:\> icacls C:\Data /grant SOC:(OI)(CI)R
C:\> net share # what's exposed over SMB
- Deny overrides allow; inheritance flows from parent folders.
- (OI)(CI) = object/container inherit — files/subfolders get the ACE.
- Writable share + executable content = classic lateral-movement drop point.
Go deeper Microsoft Learn: ACLs & SIDs
W3Users & privileges
Accounts are local or domain; each logon gets a token listing SIDs and privileges. UAC splits admin tokens into filtered/full — "Run as administrator" elevates the latter.
C:\> whoami /priv # enabled privileges
C:\> whoami /groups
C:\> net user # local accounts
C:\> net localgroup administrators
- Privileges (SeDebugPrivilege, SeImpersonatePrivilege) ≠ file permissions.
- Standard users can't write to Program Files or HKLM — by design.
- SeImpersonate + a service account is the potato-family escalation path.
Go deeper Microsoft Learn: Privileges
W4PowerShell basics
PowerShell pipes objects, not text: Verb-Noun cmdlets emit .NET objects you can filter, sort, and select without parsing strings. It is the admin and attacker language of Windows.
PS> Get-Service | Where-Object Status -eq 'Running'
PS> Get-Process | Sort-Object CPU -Descending | Select-Object -First 5
PS> Get-ChildItem C:\Users -Recurse -Filter *.kdbx
Get-Help cmdlet -Examples is the fastest way to learn any cmdlet.
- Execution policy is a safety belt, not a security boundary.
- Script-block logging (4104) is how defenders see what actually ran.
Go deeper Microsoft Learn: PowerShell path
W5Services & processes
The Service Control Manager starts background services at boot under chosen accounts; processes live in sessions with tokens. Sysinternals tools expose what Task Manager hides.
C:\> sc query type= service state= all
C:\> tasklist /svc # process-to-service map
PS> Get-CimInstance Win32_Service | Select Name,StartName,PathName
- Services running as LocalSystem are high-value targets.
- Autoruns, Process Explorer, Procmon = the triage trio.
- Unquoted service paths and weak service ACLs are persistence/escalation classics.
Go deeper Sysinternals docs · Microsoft Learn
W6Registry & persistence
The registry is a hierarchical config database (HKLM machine-wide, HKCU per-user). Run keys, services, and scheduled tasks are the legitimate — and abused — autostart locations.
C:\> reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
C:\> reg query HKLM\...\Run
PS> Get-ScheduledTask | Where State -eq 'Ready'
- HKCU Run executes at user logon; HKLM Run at any logon (needs admin to write).
- Always export a key before editing:
reg export ... backup.reg.
- Autoruns' "hide Microsoft entries" view is the fastest persistence hunt.
Go deeper Microsoft: registry for advanced users
W7Networking commands
Windows ships its own stack of diagnostics: ipconfig for addressing, nslookup for DNS, netstat for sockets, and Test-NetConnection for port-level reachability with a clean object output.
C:\> ipconfig /all
C:\> nslookup example.com
C:\> netstat -ano | findstr LISTENING
PS> Test-NetConnection example.com -Port 443
ipconfig /flushdns clears the resolver cache after DNS changes.
- netstat's last column is the PID — cross-reference with tasklist.
- Unexpected LISTENING on 4444/8080 deserves a process lookup immediately.
Go deeper Microsoft: Windows commands reference
W8Logs & security basics
Windows records security-relevant activity in event logs; Sysmon adds process/network detail. A handful of IDs cover most investigations: logons, failures, process creation, service installs.
4624 logon 4625 failed logon 4688 process create
7045 service installed 4104 PS script block
PS> Get-WinEvent -FilterHashtable @{LogName='Security';Id=4625} -MaxEvents 5
- Logon types matter: 2 interactive, 3 network, 10 RDP.
- Enable process-creation auditing with command lines (4688) — off by default.
- Brute force = 4625 bursts; lateral movement = 4624 type 3 from odd sources.
Go deeper Microsoft: events to monitor · Sysmon
04
Active Directory
5 lessons · the enterprise identity fabric
A1What AD actually is
AD DS is a LDAP-backed directory plus Kerberos authentication plus DNS, replicated across domain controllers. Domains group objects; forests group domains; OUs group objects for policy and delegation.
C:\> nltest /dsgetdc:corp.local
C:\> echo %USERDNSDOMAIN%
PS> Get-ADDomain | Select DNSRoot,DomainMode,PDCEmulator
- Trusts let users in one domain access resources in another.
- Sites map to physical networks and control replication traffic.
- Whoever controls DCs controls every identity in the domain.
Go deeper Microsoft: AD DS overview
A2Kerberos & NTLM
Kerberos uses tickets: authenticate once to the KDC for a TGT, then request service tickets (TGS) per service identified by its SPN. NTLM is the older challenge-response fallback.
C:\> klist # my cached tickets
C:\> klist purge # drop them (troubleshooting)
PS> Get-ADUser -Filter {ServicePrincipalName -like "*"} -Properties ServicePrincipalName
- Tickets are time-limited; clock skew >5 min breaks auth.
- SPNs tie a service to an account — the basis of Kerberoasting.
- NTLM relay works because NTLM lacks mutual authentication; prefer Kerberos + signing.
Go deeper Microsoft: Kerberos overview · ADSecurity.org
A3Objects & management
Users, computers, groups, and OUs are directory objects with attributes and ACLs. Day-to-day admin is PowerShell AD cmdlets or ADUC; delegation grants rights over OUs without domain admin.
PS> Get-ADUser -Filter * -Properties LastLogonDate | Sort LastLogonDate
PS> Get-ADGroupMember 'Domain Admins'
PS> Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00
- Group nesting grants rights transitively — audit nested members.
- Stale accounts and computers are attack surface; disable, don't delete blindly.
- ACLs on objects (GenericAll, WriteDACL) are escalation paths, not just "permissions".
Go deeper Microsoft: AD PowerShell module
A4Group Policy
GPOs apply settings in order: Local → Site → Domain → OU (LSDOU), with enforcement and blocking modifiers. Security filtering and WMI filters narrow who actually receives a policy.
C:\> gpresult /h report.html # what applied to me, and why
C:\> gpupdate /force
PS> Get-GPO -All | Select DisplayName,Id
- Computer settings apply at boot, user settings at logon (plus background refresh).
- Baselines (password policy, audit policy, LAPS) are usually domain-level GPOs.
- Write access to a GPO linked to DCs = domain compromise; audit GPO ACLs.
Go deeper Microsoft: Group Policy overview
A5Attack & defense awareness
Most AD attacks abuse legitimate features: requestable service tickets (Kerberoasting), pre-auth-less accounts (AS-REP), replication rights (DCSync), delegation misconfigurations. Defense is tiering, least privilege, and logging.
Kerberoasting : request TGS for SPN accounts, crack offline
AS-REP roast : accounts with DONT_REQ_PREAUTH
DCSync : DS-Replication-Get-Changes-All rights
PS> Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true}
- Mitigations: long random service-account passwords, gMSAs, pre-auth on everywhere.
- Tier admin accounts (T0/T1/T2), LAPS for local admins, restrict replication rights.
- Monitor 4768/4769 (Kerberos), 4662 (replication), 4728/4732 (group changes).
Go deeper ADSecurity.org · Microsoft security compass