chmod 适用于 Windows?
我有一个可执行文件需要在 Windows 系统上以管理员身份运行,并且它由服务启动。为了简单性和安全性,我宁愿让服务作为“系统”帐户运行,但希望它生成的可执行文件以管理权限运行。
Windows 上是否有类似 chmod +s 之类的东西可以让我执行此操作,这样当我安装东西并将服务注册为管理员时,我可以将可执行文件标记为能够以管理员身份运行,或者要执行此操作,我需要注册该服务才能以管理员身份运行吗?
I have an executable that needs to run as an administrator on a Windows system, and it's started by a service. For the sake of simplicity and security, I'd prefer just to let the service run as the 'system' account, but would like the executable that it spawns to run with administrative privileges.
Is there anything like a chmod +s
on Windows that would allow me to do this, such that when I'm installing things and registering the service as an administrator, I can flag the executable to be able to run as an administrator, or to do this would I need to register the service to run as an admin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Windows Vista 及更高版本上,您可以在可执行文件中嵌入清单文件,请求 Windows 以管理员访问权限启动程序(请参阅 创建并嵌入应用程序清单 (UAC))。这可能有用,也可能没用,因为即使您的服务本身不需要以完全管理员访问权限运行,服务帐户仍然需要管理权限。
On Windows Vista and later, you can embed a manifest file in the executable that requests Windows to start the program with administrator access (see Create and Embed an Application Manifest (UAC)). This may or may not be useful, because the service account still needs administrative privileges even though your service itself need not be running with full administrator access.