Is there any way in unix to find out who accessed certain file in last 1 week? It may be user or some script ftp it to some other place. Can I get a list of user name who accessed certain file? How can I find out who is accessing particular file??
|
Unless you have extremely unusual logging policies in place, who accessed what file is not logged (that would be a huge amount of information). You can find out who was logged in at what time in the system logs; the The date at which a file was last read is called its access time, or atime for short. All unix filesystems can store it, but many systems don't record it, because it has a (usually small) performance penalty. If a user accessed the file and wasn't trying to hide his tracks, his shell history (e.g. To find out what or who has a file open now, use To log what happens to a file in the future, use inotifywait. If you really need to know who reads a file, put it on a loggedfs filesystem. |
|||||||
|
|
This is not, in general, feasible. I have seen file systems with enough auditing to make it possible one way or the other, but it is not a general Unix thing, no. |
|||
|
|
|
The previous answer is not the best practice for doing what you ask.
Linux has an API for this. The
|
|||
|
|
Let me google that for you... Yes you can! This article shows how to use auditctl, ausearch, & aureport on linux kernels 2.6 and above. This one presents a fairly comprehensive guide. I'm sure there are performance and space overhead to consider, but for anything that requires regulatory compliance or high security, it's just the cost of doing business. |
|||
|