Lion Cipher Lab

Monitor file changes in real time with inotify

Why it matters

Baseline file integrity monitoring is powerful but patient: it takes a snapshot of your system and compares against it on a schedule, so it tells you a file changed, but only at the next check — it is blind in between. A lot of what a defender wants to know is the opposite of patient. When a program suddenly writes a new file into a web root, when something edits a config in /etc, when a binary is swapped while you watch, you want to know at the instant it happens, not at 3 a.m. tonight. Linux has that capability built into the kernel: inotify, a notification system that tells a program the…

What you'll learn

Steps in this lab

  1. What inotify is, in one breath
  2. Install inotify-tools
  3. Watch a directory and see your first event
  4. Trigger changes and watch them land
  5. Watch continuously, and watch a whole tree
  6. Log events with a timestamp, and alert on change
  7. The honest limits — where real-time watching stops
  8. Real-time and baseline, together

Open the full interactive lab →