Tobias
Tobias

Reputation: 31

MacOS X file system watcher

I am developing an utility application which logs other apps' file system activities. Therefore I am looking for a way to receive file system change notifications including the file paths as well as the corresponding PIDs.

According to my state of knowledge the only way to do this is to listen at "/dev/fsevents" using root privileges. Is there another option to track those file system changes without running a root privileged process?

Thanks in advance!

regards,
Tobias

Upvotes: 3

Views: 2493

Answers (1)

Yuji
Yuji

Reputation: 34185

No. You need to use /dev/fsevents or dtrace or something, all of which require root privilege.

As you know, the public FSEvents api doesn't give you fine grained info as you want.

But this is as it should be. When you ask "is this possible without root privilege?", you should ask yourself "do you want others to do this without root privilege on my machine?"

Then you know this is clearly wrong if it's possible without root privilege: you shouldn't be able to know, without root privilege, which file is accessed by a privileged process.

Upvotes: 3

Related Questions