Skip to content

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.

  1. 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.txt

      Full process tree.

    • ss -tulpna > /evidence/connections.txt

      All sockets with owning processes.

    • w; who; last -n 50

      Current and recent logins.

    All 16 ps commands
  2. 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 deleted

      Running binaries removed from disk.

    • ls -la /proc/<pid>/cwd

      Working directory of a suspicious PID.

    All 16 ps commands
  3. Check persistence locations

    Attackers come back. Review cron, systemd units and timers, and startup files for anything unexpected.

    • systemctl list-unit-files --state=enabled

      Services set to start at boot.

    • systemctl list-timers --all

      Timers, a favourite persistence spot.

    • cat /etc/crontab; ls -la /etc/cron.* /var/spool/cron/*

      Cron jobs for every user.

    All 19 systemctl commands
  4. 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 warning

      Warnings and errors in a time window.

    • grep -Ei "Accepted|Failed password|sudo" /var/log/auth.log

      SSH and sudo activity.

    All 21 journalctl commands
  5. Inspect accounts and keys

    New accounts, UID-0 accounts other than root, and unexpected SSH keys are common backdoors.

    • awk -F: '$3==0' /etc/passwd

      Every UID-0 account — only root should appear.

    • find / -name authorized_keys 2>/dev/null -exec ls -la {} \;

      SSH keys across the system.

    All 15 awk commands
  6. 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.txt

      Hash the collected evidence.

    • tar -czf evidence-$(hostname)-$(date +%F).tar.gz /evidence

      Bundle it for handoff.

    All 65 strings commands

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.