简体   繁体   中英

pyinotify file deletion user

I'm trying to use pyinotify to alert me whenever files are deleted, but I want to know what user deleted the files. Is there a way to find this information?

That information isn't exposed by the underlying inotify system. This is the main change notification API for the Linux kernel, so you aren't going to find another notification system that provides this.

If you want to track who deleted the file, it would be easiest to make the deleter announce what it is going to do. If you don't have control over the deleter (that is, you still have to maintain a POSIX interface for deleting the file), you could look at writing a custom file system wrapper in FUSE , which might expose the UID of the process that called unlink().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM