所有 Windows 用户都可以编辑的建议文件位置?
我正在构建一个产品,其中涉及
- 在本地计算机上缓存数据的 Windows 服务,
- 用户进程读取该数据并写入自己的数据,
- 该服务又将该数据写回到服务器。
我应该将数据文件放在哪里,以便所有用户共享它们并且可以读/写?该软件将在企业环境中运行,其中桌面有时相当锁定,因此某些用户不具有 C:\Program Files 的写入权限。
我不认为 C:\Documents And Settings\All Users\Application Data\ 是一个好的候选者 - 我认为默认情况下只有 Admins &高级用户在此处具有写入权限。
我可以使用每个用户的应用程序数据文件夹,但这会有点麻烦,因为不同的人可以使用每台机器......所以如果只有一个共享位置会更简单。
我正在使用 C# .net 2005 进行开发,但这可能不太相关。
I'm building a product that involves
- a windows service caching data on the local machine,
- user processes reading that data and writing their own data,
- the service in turn writing back that data to a server.
Where should I put the data files for this, such that they'll be shared by all users and read/writable? The software will operate in a corporate environment where desktops are sometimes pretty locked-down, so for instance some users won't have write rights to C:\Program Files.
I don't think C:\Documents And Settings\All Users\Application Data\ is a good candidate - I think by default only Admins & Power Users have write access here.
I could use each user's Application Data folder, but this would be a bit of a pain as different people could use each machine ... so it'd be simpler if there was just one shared location.
I'm developing in C# .net 2005, but that's probably not too relevant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是你没有真正的选择。您必须(您确实必须)调用 SHGetSpecialFolderLocation 来获取 c:\users\public\AppData 的路径(这是您上面链接的文件夹的名称,但在 Vista 和可能的 Windows 7 上)
然后您必须在其中创建您自己的应用程序文件夹。然后,您必须使用安全 API 修改所创建文件夹的 ACL。
系统上没有具有默认 ACL 的文件夹允许多个非管理员用户读取和写入相同的文件。
c:\users\public\AppData 是最接近的。在这里修改应用程序文件夹的 ACL 似乎是最好的方法。当然,一旦采用 ACL 修改,该文件夹确实可以在任何地方创建。但这可能会让系统管理员感到惊讶并导致奇怪的安全漏洞。
Unfortunately you have no real choice. You must (you really must) call SHGetSpecialFolderLocation to get the path to c:\users\public\AppData (which is the name of the folder you linked above, but on Vista and possibly Windows 7)
Then you MUST create your own app folder therein. And then, you MUST, use the security APIs to modify the ACL of the created folder.
There is NO folder on the system with a default ACL that allows multiple non administrator users to read AND write the same files.
c:\users\public\AppData is the closest. Modifying the ACL of a application folder here seems the best approach. Of course, once one has resorted to ACL modification, the folder really could be created anywhere at all. But that could surprise system administrators and result in weired security holes.