C# 您如何通过用户名监视文件服务器上的文件访问和更改?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/290694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you monitor file access and changes on a file server by user name?
提问by Firas Assaad
I was asked to find a way to monitor changes (modification, renaming, deletion, moving) of files in specific folders on the company's shared file server (simple windows shared directory). I wrote a simple app in C# that uses FileSystemWatcherto monitor these changes and notify a particular email address of them.
我被要求找到一种方法来监视公司共享文件服务器(简单的 Windows 共享目录)上特定文件夹中文件的更改(修改、重命名、删除、移动)。我用 C# 编写了一个简单的应用程序,它使用FileSystemWatcher来监视这些更改并通知它们的特定电子邮件地址。
What I'd like to know now is how to find out the name/IP of the user/computer who made these changes. Any ideas?
我现在想知道的是如何找出进行这些更改的用户/计算机的名称/IP。有任何想法吗?
As an alternative to writing my own software, are there any good (possibly free) software that supports this functionality?
作为编写我自己的软件的替代方案,是否有任何支持此功能的好(可能是免费的)软件?
采纳答案by Tony Lee
Use auditing - it's on the security tab when you get the properties of file/folder. You specify which users you want audited for what kind of access. You also have to turn on auditing using the security policy mmc snap-in. The audits will end up in the security log.
使用审核 - 当您获取文件/文件夹的属性时,它位于安全选项卡上。您可以指定要审核哪些用户的访问权限。您还必须使用安全策略 mmc 管理单元打开审核。审计将在安全日志中结束。
Detailed instructions from MS: http://support.microsoft.com/kb/310399
MS 的详细说明:http: //support.microsoft.com/kb/310399
If you want, your C# app could then pick the events out of the security event log.
如果需要,您的 C# 应用程序可以从安全事件日志中挑选事件。