奇怪的文件 - 如果应用程序作为管理员运行的权限 [英] Strange file-permissions if apps run as administrator

查看:314
本文介绍了奇怪的文件 - 如果应用程序作为管理员运行的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序必须以管理员身份运行,并创建一些文件。如果我通过右键单击图标并选择以管理员身份运行手动运行 - 一切正常 - 所有用户都可以访问已创建的文件。但是如果程序从另一个程序通过ShellExecuteEx与runas启动动词 - 创建的文件没有访问条目BUILTIN\Users组。只有管​​理员用户才能读取这些文件。

My program must be run as administrator and creates some files. If I run it manually by right-click on the icon and selecting "run as administrator" -- everything okay -- all users have access to created files. But if program launched from the another program by ShellExecuteEx with "runas" verb -- created files have no access entry for BUILTIN\Users group. Only administrator users can read those files.

推荐答案

为什么不设置链接器标志(VC2008和更高版本):
Linker - > Manifest - > UAC执行级别: requireAdministrator(/ level ='requireAdministrator')

Why not setup the linker flag (VC2008 and higher): Linker -> Manifest -> UAC Execution Level: requireAdministrator (/level='requireAdministrator')

编辑:我重新读取问题,发现问题可能是NTFS文件-安全。这不是你的程序的错,但这是设计。任何创建文件和文件夹的用户只能获得该用户的权限。

I re-read the question, and found that problem is probably with NTFS file-security. This is not your program's fault, but this is by design. Any user who creates files and folders is given permissions to that user only.

以管理员用户身份登录,创建一个文件夹。然后重新登录作为另一个用户(不管你喜欢),并尝试访问/读/写/删除该文件夹 - 你不能。权限授予管理员用户,而不授予everyone / users-group。

Login as administrator user, create a folder. Then re-login as another user (however you like), and try to access/read/write/delete that folder - you cannot. The permissions are granted to administrator user, and not to everyone/users-group.

这篇关于奇怪的文件 - 如果应用程序作为管理员运行的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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