Intermediate 25 minUpdated 2026-11-06
Incident triage on Linux
A Linux server is behaving oddly and you suspect a compromise. This guide is a calm first-response pass: gather volatile information, look for persistence and signs of intrusion, and preserve evidence as you go. Where possible, capture memory before you start poking, and work from copies.
Capture the volatile picture
Record what is running, who is logged in and what is connected right now. This information is gone after a reboot.
ps auxf > /evidence/ps.txtFull process tree.
ss -tulpna > /evidence/connections.txtAll sockets with owning processes.
w; who; last -n 50Current and recent logins.
Look for suspicious processes
Hunt for processes whose binary was deleted after launch, or that run from odd locations — classic malware behaviour.
ls -l /proc/*/exe 2>/dev/null | grep deletedRunning binaries removed from disk.
ls -la /proc/<pid>/cwdWorking directory of a suspicious PID.
Check persistence locations
Attackers come back. Review cron, systemd units and timers, and startup files for anything unexpected.
systemctl list-unit-files --state=enabledServices set to start at boot.
systemctl list-timers --allTimers, a favourite persistence spot.
cat /etc/crontab; ls -la /etc/cron.* /var/spool/cron/*Cron jobs for every user.
Review authentication and logs
Failed and successful logins, sudo use and service restarts build a timeline of what happened and when.
journalctl --since "yesterday" -p warningWarnings and errors in a time window.
grep -Ei "Accepted|Failed password|sudo" /var/log/auth.logSSH and sudo activity.
Inspect accounts and keys
New accounts, UID-0 accounts other than root, and unexpected SSH keys are common backdoors.
awk -F: '$3==0' /etc/passwdEvery UID-0 account — only root should appear.
find / -name authorized_keys 2>/dev/null -exec ls -la {} \;SSH keys across the system.
Preserve what you found
Hash and copy the artefacts you collected so they hold up later. Note timestamps and keep originals untouched.
sha256sum /evidence/* > /evidence/hashes.txtHash the collected evidence.
tar -czf evidence-$(hostname)-$(date +%F).tar.gz /evidenceBundle it for handoff.
This is triage, not a full forensic investigation. If you confirm a compromise, preserve a memory image and disk copy for deeper analysis with Volatility and Sleuth Kit, and follow your organisation’s incident process for containment and reporting.
More guides
Network recon from zero
Go from a single IP range to a map of live hosts, open ports and running services.
Web application enumeration
Map a web application’s surface: technologies, hidden content, parameters and obvious vulnerability classes.
Linux privilege-escalation checklist
A methodical local enumeration pass to find the path from a low-privilege shell to root.