Most servers on the internet run Linux, so most server breaches end with a Linux investigation. The good news: Linux keeps plain-text records of almost everything.
Where to look
| Artifact | Location | What it tells you |
|---|---|---|
| Auth log | /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL) | SSH logins, failed passwords, sudo use |
| Login history | /var/log/wtmp (read with last), /var/log/btmp (lastb) | Who logged in, from where, for how long |
| Shell history | ~/.bash_history, /root/.bash_history | Commands a user typed |
| Scheduled tasks | /etc/crontab, /etc/cron.d/, /var/spool/cron/crontabs/ | Jobs that run automatically, a favourite persistence trick |
| Services | /etc/systemd/system/ | Custom services that start at boot |
| SSH keys | ~/.ssh/authorized_keys | Keys that allow password-less login |
| Temp folders | /tmp, /var/tmp, /dev/shm | Where attackers drop their tools |
Investigating a brute-force attack
Who tried to guess passwords, and how many times?
grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -nr | head
Did any of them get in?
grep "Accepted" /var/log/auth.log
last -i | head -20
An IP that fails 500 times and then appears in an "Accepted" line is your attacker's way in.
Hunting persistence
cat /etc/crontab; ls -la /etc/cron.d/
sudo ls -la /var/spool/cron/crontabs/
sudo cat /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys
ls -lat /etc/systemd/system/ | head
sudo find / -xdev -type f -newermt "2026-11-01" 2>/dev/null | head -50
The last command lists files changed since a given date. Swap in the date your incident started.
Spotting cleared logs and anti-forensics
Attackers try to erase their tracks, but erasing leaves its own clues:
| Attacker trick | What you'll notice |
|---|---|
Emptied a log with > /var/log/auth.log | File is 0 bytes or suspiciously small, with a recent modify time |
Disabled history with unset HISTFILE or ln -sf /dev/null ~/.bash_history | .bash_history is missing, empty or a link to /dev/null |
| Deleted specific lines | Gaps in timestamps: hours with no entries on a busy server |
Faked file times with touch | The change time (ctime) is newer than the modify time (mtime) |
Check timestamps with stat:
stat /var/log/auth.log
ls -la ~/.bash_history
touch can fake the modify time, but not the change time. ctime updates whenever a file's metadata changes, including when someone runs touch.
Tip: If logs were also sent to a SIEM or a remote syslog server, compare the two. Attackers clear the local copy but rarely reach the remote one.
Don't forget the journal
On systemd systems, the journal keeps its own copy of many events, and some newer distributions log only there:
journalctl _COMM=sshd --since "2026-11-20" --until "2026-11-22"
On Linux, the question is rarely "is there evidence?" It's "which of the twelve places did the attacker forget to clean?"