I have written a script which is deployed just by putting it in a globally accessible location for all users. I want to log the usage of this script.

Is there a way in Linux to find out how many times a file was read/accessed?
And if possible to determine by who ?

Edit: I do not have the root privileges, and auditd isn't an option, since its not already available.


Not with the default ext2/3/4 linux file system, I think your only solution is to log the usage of your file into a log file (but people could find that file and modify it.
So my advice would be to use a small web service (PHP, Python or even perl that increment a value in a db so people could not change the value easily).

Edit 1:
Well it seems some software could accomplish such a task see the post
Script to count number of times a file has been accessed

Edit 2 (as state by commentators):
You can start with a good tutorial on auditd deamon.
And also search google or Duck duck go for auditd which is the name of the deamon you will need.

  • 3
    @deowood it takes me a 2 minutes search to find this, you could try to make your homework before asking that fast next time. ;-)
    – Kiwy
    Jan 24 '14 at 8:57
  • I did my homework, but had no success; probably wrong choice of keywords!
    – deowood
    Jan 24 '14 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.