简体   繁体   English

无法在Windows上以非管理用户身份执行批处理文件

[英]Unable to execute batch files with non-administrative user on windows

I have some batch files which are created by the administrator and I need non-administrative users to run them. 我有一些由管理员创建的批处理文件,我需要非管理用户才能运行它们。 I have given permission to the non-administrative user to read and execute to the file and the entire folder tree. 我已授予非管理用户读取和执行文件和整个文件夹树的权限。 I am still not able to run the batch file, I am getting an "Access Denied" error. 我仍然无法运行该批处理文件,但出现“访问被拒绝”错误。

Are there any more permissions that I need to set? 我还需要设置更多权限吗? ( These batch files start / stop windows services). (这些批处理文件启动/停止Windows服务)。

You could use runas as stated here: https://superuser.com/questions/973349/is-there-a-windows-equivalent-of-the-setuid 您可以按照此处所述使用runashttps : //superuser.com/questions/973349/is-there-a-windows-equivalent-of-the-setuid

but it would require the users to know the administator password. 但这将要求用户知道管理员密码。

Another "hack": you could create a running service which would look in a given folder (say C:\\trigger ) every 10 minutes, and if it finds some file in here, then starts/stop the service and deletes the file. 另一个“ hack”:您可以创建一个正在运行的服务,该服务每10分钟在给定的文件夹(例如C:\\trigger )中查找一次,如果它在此处找到某个文件,则启动/停止该服务并删除该文件。

Users could simply use a script that would create that file, which would start the service after a while. 用户只需使用将创建该文件的脚本,该脚本将在一段时间后启动该服务。

Since the service just starts/stop a given service, there is no security issue. 由于该服务仅启动/停止给定服务,因此没有安全问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM