How to detect which process has used a file now or in the past
6
votes
1
answer
625
views
This is a hypothetical question, not a problem I currently have.
How do you detect which process has used a file now *or in the past*?
To find out which process is accessing
(*) not to mention that
filename
right now, lsof filename
or fuser filename
will do the work. But what if one wanted to know which processes accessed filename
*in the last 24 hours*?
One could get away with this ugly (*) hack
while true; do fuser filename; sleep 1; done
and let it run for 24 hours in another term.
But is there actually a better system, without setting up a whole audit framework?
(*) not to mention that
fuser
could fail to detect the access if it took less than 1 sec...
Asked by dr_
(32068 rep)
Dec 6, 2019, 03:53 PM
Last activity: Dec 6, 2019, 04:11 PM
Last activity: Dec 6, 2019, 04:11 PM