安全权限脚本 [英] Scripts for security permissions

查看:110
本文介绍了安全权限脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写两个脚本,它们可以是vbs或ms-dos命令.

首先是设置文件夹的用户权限(等同于:右键单击文件夹,属性,安全性,编辑,添加,NT AUTHORITY \ NETWORK SERVICE).

其次是设置权限作为服务运行,等效单击单击是:控制面板"/管理工具"/本地安全策略";左侧:本地策略/用户权限分配;右侧:作为服务登录->将网络服务添加为具有权限的用户.

I want to write two scripts, they can be vbs or ms-dos commands.

First is setting a user permission for a folder (the equivalent to: right click on a folder, properties, security, edit, add, NT AUTHORITY\NETWORK SERVICE).

Second is to set a permision to run as a service, the equivalent click click is: Control Panel / Administrative Tools / Local Security Policy; left side: Local Policies / User Rights Assignment; right side: Log on as a service -> add Network Service as a user that has rights.

Would somebody help me to do that please?

推荐答案

您可以使用实用程序CACLS.EXE编写此类脚本,这是有关它的帮助:http://ss64.com/nt/cacls.html [
You can write such scripts using the utility CACLS.EXE, here is the help on it: http://ss64.com/nt/cacls.html[^].

Alternatively, run
CACLS > cacls.help.txt

来获取文本文件,其中包含系统中当前可用的实用程序的选项.

不用说,执行批处理脚本的帐户应具有足够的权限来修改有问题的权限.您可以使用感兴趣的文件系统对象的属性对话框在UI中进行检查.

—SA

to obtain the text file with the options of the utility currently available in your system.

Needless to say, the account on which your batch script is executed should have enough permission to modify the permissions in questions. You can check this in UI using the properties dialog of the file system object you are interested in.

—SA


感谢回答!

我使用的命令是:
文件夹权限:
thanks for answer!

the commands I used are:
folder permission:
CACLS path_of_folder /E /T /C /G "userName":F


作为服务登录:


log on as a service permission:

ntrights -u "userName" +r SeServiceLogonRight



在这里您可以找到
权利说明



Here you can find ntrights description


这篇关于安全权限脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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