How to Find Files with Status Changes in the Last 24 Hours (find -ctime -1)

The Metadata Security Audit

In Ubuntu Linux, tracking file modifications (when the actual contents of a file are edited) is common. However, advanced attackers or broken deployment scripts often change a file’s status without altering its contents. A “status change” includes modifying the file’s ownership (chown), changing its execution permissions (chmod), or moving it to a new directory. If a hacker grants themselves root execution rights on an existing binary, the file’s “mtime” will not change, completely bypassing a standard file audit. To detect these insidious permission changes, you must instruct the Linux search engine to filter strictly by the “change time” (ctime) of the file’s metadata.

Using the find Command with -ctime -1

The Linux find command utilizes the -ctime (change time) flag combined with a negative integer (-1) to search for files whose metadata, permissions, or ownership were altered less than one day (24 hours) ago.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To scan the /var/www/ directory and return every file that had a permission or ownership change in the last 24 hours, type the following command exactly:
  3. sudo find /var/www/ -type f -ctime -1
  4. Press Enter and provide your administrator password.

Exposing Permission Hijacks

Because you are hunting for unauthorized permission changes, prefixing the command with sudo ensures you have visibility into every hidden folder. The search engine will recursively dig through all subdirectories and output the absolute path of every file that experienced a metadata shift within the 24-hour window. If this command returns a list of system binaries or web scripts whose contents haven’t changed in months, you have instantly discovered a permission hijack, allowing you to lock down the compromised files before they can be executed.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.