监控文件夹权限
任何人都知道我们如何监控 Windows 上的文件/文件夹权限。 假设用户可以更改文件夹权限,应用程序可以记录用户、时间和其他详细信息。
如果 neone 知道相同的第三方工具/脚本,请建议。
-谢谢
Anyone know how can we moniter file /folder permission on windows. Suppose a user can change the folder permission, the application can log the user, timing and other details.
If neone know third party tool/script for the same, plz suggest.
-Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用
FileSystemWatcher
类,当目录或文件的各种属性发生更改时可以引发事件。 就您而言,您需要确保设置 < code>NotifyFilter 属性以包含NotifyFilters.Security
标志,指示监视任何权限更改。 MSDN 页面上给出了一些很好的示例代码,尽管FileSystemWatcher
使用起来确实非常简单。You'll want to use the
FileSystemWatcher
class, which can raise an event when various properties of directories or files change. In your case, you want to insure you set theNotifyFilter
property to include theNotifyFilters.Security
flag, which tells is to watch any permissions changes. Some good example code is given on the MSDN page, thoughFileSystemWatcher
is really quite straightforward to use.启用文件系统审核,并在父文件夹上设置 SACL 以审核权限和所有权更改。 它们将在系统事件日志中报告。
Enable filesystem auditing, and set the SACL on a parent folder to audit permission and ownership changes. They will be reported in the System event log.