2

I'm trying to monitor the access to symlinks, i.e. if a symlink is used to access a file. With Pyinotify I can monitor access to files, but I do not get any events when reading a file through its watched symlink (e.g. head symlink_to_file.txt).

To test this, I used the loop.py example from Pyinotify and simply replaced the folder /tmp.

From reading the documentation I think that by using IN_DONT_FOLLOW, I should get events for accessing the symlink instead of the file it points to, but modifying the line that adds the watch to

wm.add_watch('./', pyinotify.ALL_EVENTS | pyinotify.IN_DONT_FOLLOW)

does not yield any additional events.

Then how do I monitor the access of symlinks? Is this the wrong place to add IN_DONT_FOLLOW? Am I trying to use the inotify interface for something it was not designed to do?

user3141592
  • 121
  • 1
  • 10

0 Answers0