There's a process in my system (a standard desktop installation with upwards of 150 quiescent processes at any time) that is sporadically resetting a config file's permissions that I have explicitly set so that it could be read by multiple users.
Even though I have ways to prevent that from happening (eg, changing the file's owner), I really want to find the process that is doing the change, if only so that I can terminate it with extreme prejudice.
I know the kernel has at least 2 mechanisms for this, inotify
and the more recent fanotify
. However, the latter only intercepts changes to file contents, not to the inode, while the former does detect such changes but doesn't report the process responsible.
So is there another kernel mechanism which i don't know about? Or some other roundabout way of "trapping" the process as it's going to change the file's permissions, or after it has done so?
auditctl -w /path/to/that/file -p [r|w|x|a]
. Then just watch the generated log file at/var/log/audit/audit.log
. – Cbhihe May 30 '20 at 20:12