Strange file-permissions if apps run as administrator

大兔子大兔子 提交于 2020-01-04 05:17:28

问题


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.


回答1:


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

EDIT: 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.

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.



来源:https://stackoverflow.com/questions/5605017/strange-file-permissions-if-apps-run-as-administrator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!