Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileSystemWatcher - minimum permissions needed on target directories?

Using the .NET FileSystemWatcher http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx to monitor a directory full of files for : Changed; Created; Deleted; Renamed events .

What's the minimum the rights the Account running the FileSystemWatcher needs over the directory it's watching ?

It seems like it would be READ but I can't find that documented anywhere.

Thanks

like image 994
glaucon Avatar asked Jan 22 '23 06:01

glaucon


1 Answers

If the FileSystemWatcher is based on ReadDirectoryChangesW it needs:

  1. FILE_LIST_DIRECTORY on the directory to be monitored
  2. The privilege SeBackupPrivilege which allows the holder to read anything while bypassing access checks. The indication for this is the flag FILE_FLAG_BACKUP_SEMANTICS to CreateFile.

This is documented in the description of ReadDirectoryChangesW linked above.

like image 72
Helge Klein Avatar answered Feb 09 '23 14:02

Helge Klein