Linux forensic artefacts: logs, shell history, persistence and timelines
In short: Linux keeps evidence in authentication logs, the systemd journal, shell history, scheduled tasks, user and sudo files, SSH authorized_keys and application logs such as web server access logs. Investigators collect volatile data first, then examine these artefacts for logins, new accounts, persistence and commands, and combine them into a timeline.
Why Linux needs its own approach
Most web servers, cloud workloads and network appliances run Linux, so many incidents involve it. Linux stores evidence differently from Windows: there is no registry, and much of the evidence is in plain text files and logs. The Windows equivalent is covered in Windows forensic artefacts. As always, collect the most volatile data first, following the order of volatility: running processes, network connections and logged-in users before anything else.
Logs
| Log | What it shows |
|---|---|
| /var/log/auth.log (Debian, Ubuntu) or /var/log/secure (Red Hat family) | SSH logins, failed passwords, sudo use, new users |
| systemd journal (read with journalctl) | Service starts, stops, errors and boot events |
| /var/log/syslog or /var/log/messages | General system events |
| wtmp, btmp and lastlog (read with last, lastb, lastlog) | Successful and failed login history |
| Web server logs, e.g. /var/log/nginx or /var/log/apache2 | Requests to websites, including attack attempts |
Attackers sometimes delete or edit logs, so gaps or missing files are themselves evidence. Sending logs to a central SIEM in real time protects them. Practise reading these with the Linux log analysis lab.
Persistence and user activity
- Accounts: check /etc/passwd for new users, especially with user ID 0, and /etc/sudoers for unexpected admin rights.
- SSH keys: an unknown key in a user's ~/.ssh/authorized_keys gives the attacker a permanent way back in.
- Scheduled tasks: look at crontabs for every user, /etc/cron.* folders and systemd timers and services.
- Shell history: ~/.bash_history may show commands the attacker typed, though it can be disabled or deleted.
- Temporary folders: /tmp and /dev/shm are common places for dropped tools.
Building a timeline
File timestamps show when files were modified or changed, and log entries show logins and service events. Put them together in time order, using the same time zone (ideally UTC) throughout. Work on a forensic copy where possible, because commands on a live system can change timestamps.
Real-world example: the web server that mined crypto
A fictional e-commerce company notices its web server running at full CPU. The investigator first records running processes and network connections, finding a crypto-mining program connecting to an overseas pool. The web server logs show exploit attempts against an outdated plugin, followed by a successful upload of a small script. Auth logs show no SSH logins, but a new crontab entry for the web user restarts the miner every ten minutes, and an unknown SSH key has been added for a backup account. The timeline links the plugin exploit to every later change. The company rebuilds the server, updates the plugin, removes the key and sends logs to its SIEM.
Practice
Where are SSH logins recorded on Ubuntu and on Red Hat systems?
Name two common Linux persistence methods.
Why should logs be sent to a central SIEM?
Key takeaways
- Collect volatile data first: processes, connections and logged-in users.
- Auth logs, the journal and web server logs show logins and attacks.
- Check accounts, sudoers, SSH keys and scheduled tasks for persistence.
- Missing or edited logs are evidence too; central logging protects them.
- Combine logs and file times into a single UTC timeline.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.