Cheat sheet

Linux artefacts

Where to look for traces of an intrusion on a Linux server: logs, persistence and user activity. The basics are in Linux essentials.

CDSACJCAForensics

Logs

FileContents
/var/log/auth.logAuthentication, sudo and SSH (Debian, Ubuntu)
/var/log/secureAuthentication, sudo and SSH (RHEL, Fedora)
/var/log/syslogGeneral system messages (Debian, Ubuntu)
/var/log/messagesGeneral system messages (RHEL, Fedora)
/var/log/wtmpLogon history, read with last
/var/log/btmpFailed logons, read with lastb
/var/log/lastlogLast logon of each account, read with lastlog
/var/log/audit/audit.logAudit events (auditd)
journalctlsystemd journal (services, kernel, logons)
grep "Accepted" /var/log/auth.log            # successful SSH logons
grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn
last -f /var/log/wtmp ; lastb | head           # logons and failures
journalctl -u ssh --since "2026-11-01" --until "2026-11-02"

Persistence

LocationMechanism
/etc/crontab, /etc/cron.d/System scheduled tasks
/var/spool/cron/Users' scheduled tasks (crontab -l)
/etc/systemd/system/Added systemd services and timers
~/.bashrc, ~/.profileCommands run when a shell opens
~/.ssh/authorized_keysKeys allowed to log in over SSH
/etc/ld.so.preloadLibrary loaded into every process
/etc/rc.localScript run at boot (older mechanism)
/etc/passwd (UID 0)Extra account with root rights

Activity traces

ItemContents
~/.bash_historyCommands typed in bash
~/.viminfoFiles opened and searches made in vim
~/.ssh/known_hostsHosts the account connected to over SSH
/tmp, /dev/shmWorld-writable folders, often used to drop tools
/proc/<pid>/exeLink to a process's executable, even if deleted from disk
/proc/<pid>/cmdlineFull command line of a process
ls -la /proc/*/exe 2>/dev/null | grep deleted   # processes started from a deleted file
find / -xdev -newermt "2026-11-01" -type f 2>/dev/null | grep -v ^/proc   # files changed since a date
awk -F: '$3 == 0' /etc/passwd                     # accounts with UID 0
Empty history?An empty ~/.bash_history, one linked to /dev/null, or an unset HISTFILE variable is a clue in itself: the attacker wanted to cover their tracks.