At a glance
- Owner
- StratQuad
- Version
- November 2026
- Applies to
- Most modern Linux distributions using systemd (Debian, Ubuntu, RHEL and derivatives)
- Mandatory
- Reference
Key points
- On a suspected compromise, collect volatile data (processes, network connections, logged in users) before anything that changes the system.
- Run commands from trusted binaries where possible; an attacker with root can replace tools such as ps and netstat.
- Log locations differ: where rsyslog is installed, Debian and Ubuntu use /var/log/auth.log and RHEL family systems use /var/log/secure. Debian 12 and later do not install rsyslog by default and log to the systemd journal.
- Most commands below need root or sudo to show other users' data.
Users and access
Bash
who; w; last -a | head -20 # current and recent logins (wtmpdb last on Debian 13)
lastb | head -20 # failed logins (lslogins --failed on Debian 13)
cat /etc/passwd | awk -F: '$3==0' # accounts with UID 0
getent group sudo wheel # members of admin groups
ls -la /home/*/.ssh/ /root/.ssh/ # SSH key directories
cat /root/.ssh/authorized_keys # keys allowed to log in as root
Processes
Bash
ps auxf # all processes as a tree
ps -eo pid,ppid,user,lstart,cmd --sort=lstart | tail -30 # newest processes
ls -la /proc/*/exe 2>/dev/null | grep deleted # running binaries deleted from disk
lsof -nP | grep -E "(deleted)" # open files that were deleted
Network
Bash
ss -tulpn # listening sockets with processes
ss -tanp state established # established TCP connections
ip -br addr; ip route # interfaces and routes
cat /etc/hosts; cat /etc/resolv.conf # name resolution overrides
iptables -S 2>/dev/null; nft list ruleset 2>/dev/null # firewall rules
Persistence
Bash
crontab -l; ls -la /etc/cron.* /var/spool/cron/ # scheduled jobs
systemctl list-unit-files --state=enabled # enabled services
systemctl list-timers --all # systemd timers
ls -la /etc/systemd/system/ ~/.config/systemd/user/ 2>/dev/null
cat /etc/rc.local 2>/dev/null
grep -r "" /etc/ld.so.preload 2>/dev/null # preloaded libraries
find / -perm -4000 -type f 2>/dev/null # SUID binaries
Files
Bash
find / -xdev -mtime -2 -type f 2>/dev/null | grep -vE "^/(proc|sys)" # changed in last 2 days
find /tmp /var/tmp /dev/shm -type f -exec ls -la {} \; 2>/dev/null # temp directories
sha256sum /path/to/file # hash for threat intelligence lookups
Logs
Bash
journalctl --since "24 hours ago" -p warning # warnings and above
journalctl -u ssh --since today # SSH service (sshd on RHEL)
grep -E "Accepted|Failed" /var/log/auth.log | tail -50 # SSH logins (Debian, Ubuntu)
grep -E "Accepted|Failed" /var/log/secure | tail -50 # SSH logins (RHEL family)
cat ~/.bash_history /root/.bash_history # shell history (easily cleared)
Practitioner note
Before running anything on a host you think is compromised, decide whether you need a forensic image. Commands change access times and can trigger attacker cleanup scripts. For serious incidents, capture memory and disk first with a trusted toolkit, then triage from the copy.
Sources
- freedesktop.org. systemd journalctl manual (opens in a new tab)
- man7.org. Linux man pages (opens in a new tab)