本文介绍了即使授予用户组完全权限,也无法在C:\ ProgramData \中创建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序试图写入C:\ ProgramData \文件夹中的Access数据库(.mdb).在启用了UAC的计算机上,我们发现访问数据库失败,因为它似乎无法创建锁定文件.似乎默认情况下(可能是由于UAC)用户(包括管理员)默认情况下没有写应用程序文件夹的权限.

We have an application which tries to write to an Access database (.mdb) in the C:\ProgramData\ folder. On computers with UAC enabled we find that accessing the database fails as it seems it cannot create the lock file. It seems that by default (and perhaps due to UAC) users (including admins) don't have permission to write to the applications folder by default.

我们认为,授予用户"组对该文件夹的完全权限将解决此问题,但是没有什么区别.即使授予每个人"完全控制权也无济于事.解决该问题的唯一方法似乎是将数据库移到另一个不是最佳实践的文件夹(例如C:\ applicationname)中,或者通过更改快捷方式以管理员权限运行该应用程序.

We thought that granting the "Users" group full permissions to this folder would fix the problem, however it makes no difference. Even granting "Everyone" full control still doesn't help. The only thing which fixes the problem seems to be to move the database into another folder (eg C:\applicationname) which is not best practice OR running the application with Administrator privileges by changing the shortcut.

如何使普通用户可以在C:\ ProgramData \文件夹中写入(和创建文件)?还是我们滥用此文件夹?我给人的印象是,这是放置共享程序数据(对于所有用户)的正确位置,而许多其他应用程序似乎已将其数据存储在我的计算机上.

How can we make it so normal users can write (and create files) in the C:\ProgramData\ folder? Or are we misusing this folder? I was under the impression that is the correct place to put shared program data (for all users) and many other applications seem to have put their data there on my computer.

更新:

我发现数据库的克隆副本已放入以下文件夹:C:\ Users \\ AppData \ Local \ VirtualStore \ ProgramData \

I have found that a clone copy of the database has been put in to following folder:C:\Users\\AppData\Local\VirtualStore\ProgramData\

如果删除此文件夹,则应用程序将正常运行.为什么创建此文件夹?我可以以某种方式防止这种情况发生吗?可能是因为安装程序没有为C:\ ProgramData \中的文件夹上的Users组提供足够的权限吗?

If I delete this folder, the application then performs normally. Why was this folder created? Can I prevent this somehow? Could it be because the installer does not give adequate permissions to the Users group on the folder in C:\ProgramData\ ?

推荐答案

实际上,很可能是安装程序没有足够的权限直接与"C:\ ProgramData \"混在一起. (我认为这种情况听起来很熟悉....)

Actually, it is more likely that the installer did not have sufficient permissions to mess with "C:\ProgramData\" directly. (I thought that this scenario sounded familiar....)

当Microsoft引入 UAC 时,他们需要一种使旧应用程序继续运行的方法,至少对于一会儿.他们想到的是文件和注册表虚拟化",其中试图访问(现在) verboten 系统文件夹或注册表项的旧应用程序将被重定向到他们自己的用户特定的虚拟化"副本.这些资源中.正如 UAC 上的Wikipedia文章所述:

When Microsoft introduced UAC they needed a way for older applications to continue working, at least for a while. What they came up with was "File and Registry virtualization", where legacy applications that tried to access (now-)verboten System folders or registry entries would be redirected to their own user-specific "virtualized" copy of those resources. As the Wikipedia article on UAC describes it:

如果安装程序请求以管理员身份运行"特权,则应该可以避免此问题.

If your installer requests "Run as administrator" privileges then you should be able to avoid this issue.

这篇关于即使授予用户组完全权限,也无法在C:\ ProgramData \中创建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 06:19
查看更多