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 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...