How to find who opened/modified a file last

Hi *,

I'm wondering if it possible to know WHO opened or modified a file last?
I know it's possible with some options of find and also ls to get when the file was modified last.
I'm currently supervising a file and have to log all users name who opened or modified it.

Thanx a lot for any help or tips.:confused:

Regards

That's not the sort of information which gets stored in the inode, no. The file really doesn't know who modified it.

If you wanted to be really strict about it, you could create an isolated account and prevent anyone but that account from reading the file, then set up a rule with sudo to run a script which edits the file as that user. That script would be the only way people could read or edit that file.

1 Like

Thanx Corona688,
Does it exist a way to find who runs his script last? :slight_smile:

Again, no, the operating system doesn't store such trivia by itself.

But that's what the script is for. It logs who runs it, and when.

You may even be able to just check the system logs to see who's doing what with sudo.

1 Like