简体   繁体   English

允许非管理员用户进程读取文件

[英]Allow File to be Read by Non-Admin User Process

My installer runs with elevated privileges and writes a file (A) to $APPDATA (C:/ProgramData) aswell as writting files to $PROGRAMFILES . 我的安装程序以提升的特权运行,并将文件(A)写入$APPDATA (C:/ ProgramData)并将文件写入$PROGRAMFILES File A is a .addin file read by an application called Revit. 文件A是一个名为Revit的应用程序读取的.addin文件。

My Problem: Because the file A is created by an admin process, this file is unable to be read by Revit when the user is a Non-Admin windows user. 我的问题:由于文件A是由管理员进程创建的,因此当该用户是非管理员Windows用户时,Revit将无法读取该文件。

I would like to edit the file A so that it can be read by the a Non-Admin windows user but I dont know how. 我想编辑文件A 以便非管理员Windows用户可以读取它,但我不知道如何。 Can you suggest how I can achieve this? 您能建议我如何实现这一目标吗?

I have tried using the NSIS function SetFileAttributes "myFilePath.addin" NORMAL but this doesn't work. 我试过使用NSIS函数SetFileAttributes "myFilePath.addin" NORMAL但这不起作用。

Note: I am aware I could run my installer without elevated privileges and then Revit could read the file but as I mentioned above my installer also writes to $PROGRAMFILES so I need elevated privileges. 注意:我知道我可以在没有提升特权的情况下运行我的安装程序,然后Revit可以读取该文件,但是如上所述,我的安装程序还会写入$PROGRAMFILES因此我需要提升特权。

Use the AccessControl plugin to change the DACL: 使用AccessControl插件来更改DACL:

; This gives read access to the everyone group, use (BU) or (S-1-5-32-545) for BUILTIN\Users
AccessControl::GrantOnFile "$INSTDIR\myfile" "(S-1-1-0)" "GenericRead" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为以非管理员用户帐户运行的进程创建防火墙规则 - Creating Firewall rule for a process running in a Non-admin user account 非管理员用户的 SignTool 证书位置 - SignTool Certificate Location for non-Admin user 如何在Windows中将文件读写为程序但对非管理员用户具有只读/无访问权限? - How to make a file read-write to a program but read-only/no access to non-admin users in Windows? 如何从提升的 PowerShell 控制台以非管理员身份运行进程? - How to run a process as non-admin from an elevated PowerShell console? 通过自动登录将Win 7 Shell更改为非管理员用户帐户 - Change Win 7 Shell for non-admin user account with autologon Windows:获取非管理员用户的进程执行路径 - Windows: get processes exec path on non-admin user 以非管理员用户身份在Windows中运行重复任务的最佳方法? - Best way to run a recurring task in windows as a non-admin user? VBS脚本以标准(非管理员)用户身份运行 - VBS script to run as standard (non-admin) user 向非管理员用户授予访问权限以启动/停止服务Windows 7 - Grant access to non-admin user to start/stop services windows 7 安装可以由非管理员用户启动的 Windows 服务 - Installing a windows service that can be started by a non-admin user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM