Free tech learning for everyone, from basics to pro

Digital ForensicsCyber SecurityIntermediate

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.

Where Linux keeps useful evidence/var/logauth, syslog, securesystemd journalservice and boot logsShell historycommands typedcron and systemd timersscheduled tasksUser accountspasswd, shadow, sudoersSSH filesauthorized_keys
Figure 1. Attackers often add SSH keys or scheduled tasks to keep access, so check these early.

Logs

LogWhat 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/messagesGeneral 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/apache2Requests 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

Building a Linux incident timelineCollectlogs, files,volatile dataLogin eventswho, when,from whereChangesnew users,keys, tasksFile timescreated andmodifiedTimelineput it inorder
Figure 2. Combine log entries and file timestamps into one ordered list of events.

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?
In /var/log/auth.log on Debian and Ubuntu, and /var/log/secure on Red Hat family systems.
Name two common Linux persistence methods.
Any two of: new user accounts, SSH keys in authorized_keys, cron jobs, systemd services or timers.
Why should logs be sent to a central SIEM?
Attackers can delete or edit local logs; central copies preserve the evidence.

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.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

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.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: