即使授予用户组完全权限,也无法在C:\ ProgramData \中创建文件 [英] Cannot create files in C:\ProgramData\ even after granting Users group full permission

查看:647
本文介绍了即使授予用户组完全权限,也无法在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 \中的文件夹上的Users组提供足够的权限吗?

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:

在假定用户将以管理员权限运行的应用程序中,使用受限的用户帐户运行时,在Windows的早期版本中会遇到问题,这通常是因为它们尝试写入计算机范围或系统目录(例如程序文件)或注册表项(尤其是HKLM).[4] UAC尝试使用文件和注册表虚拟化来缓解这种情况,该操作会将写入(以及随后的读取)重定向到用户配置文件中每个用户的位置.例如,如果应用程序尝试写入用户没有写许可权的目录,例如"C:\ Program Files \ appname \ settings.ini",则写操作将被重定向到"C:\ Users \ username" \ AppData \ Local \ VirtualStore \ Program Files \ appname \ settings.ini".重定向功能仅适用于非高架32位应用程序,并且仅当它们不包含要求特定特权的清单时才提供.[13]

Applications written with the assumption that the user will be running with administrator privileges experienced problems in earlier versions of Windows when run from limited user accounts, often because they attempted to write to machine-wide or system directories (such as Program Files) or registry keys (notably HKLM).[4] UAC attempts to alleviate this using File and Registry Virtualization, which redirects writes (and subsequent reads) to a per-user location within the user's profile. For example, if an application attempts to write to a directory such as "C:\Program Files\appname\settings.ini" to which the user does not have write permission, the write will be redirected to "C:\Users\username\AppData\Local\VirtualStore\Program Files\appname\settings.ini". The redirection feature is only provided for non-elevated 32-bit applications, and only if they do not include a manifest that requests specific privileges.[13]

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

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆