cacls
小猪老师 发表于 2020-06-17 14:34浏览次数:
使用cacls命令,用户可以查看和修改文件的ACL。
The cacls command enables a user to view and modify an ACL of a file.
Cacls现在已弃用。如果您使用的是Windows 7或更高版本,请改用icacls。
如果要更改文件的读/写,隐藏的系统设置,请参阅attrib命令。
Cacls is now deprecated. If you are using Windows 7 or later, use icacls instead.
If you want to change the read/write, hidden, system settings of the file see the attrib command.
目录:
1 cacls 运行系统环境
2 Cacls Windows Vista和更高版本的语法
3 Windows XP和更早的语法
4 Cacls 示例
cacls 运行系统环境
Windows xp
Windows vista
Windows 2000
Windows 7
Windows 8
Windows 10
Windows NT
Cacls Windows Vista和更高版本的语法
显示或修改文件的ACL(访问控制列表)。
CACLS file name [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]
[/R user [...]] [/P user:perm [...]] [/D user [...]]
file name
|
显示 ACL。
|
/T
|
更改当前目录及其所有子目录中指定文件的 ACL。
|
/M
|
对照目标处理符号链接本身
|
/L
|
更改装载到目录的卷的 ACL
|
/S
|
显示 DACL 的 SDDL 字符串。
|
/S:SDDL
|
使用在 SDDL 字符串中指定的 ACL 替换 ACL。(/E、/G、/R、/P 或 /D 无效)。
|
/E
|
编辑 ACL 而不替换。
|
/C
|
在出现拒绝访问错误时继续。
|
/G user:perm
|
赋予指定用户访问权限:
R
读取
W
写入
C
更改(写入)
F
完全控制
|
/R user
|
撤销指定用户的访问权限(仅在与 /E 一起使用时合法)。
|
/P user:perm
|
替换指定用户的访问权限:
N
无
R
读取
W
Write
C
更改(写入)
F
完全控制
|
/D user
|
拒绝指定用户的访问。
|
缩写:
CI - 容器继承。 ACE 会由目录继承。
OI - 对象继承。 ACE 会由文件继承。
IO - 只继承。 ACE 不适用于当前文件/目录。
ID - 已继承。 ACE 从父目录的 ACL 继承。
Displays or modifies ACLs (access control lists) of files.
CACLS file name [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]
[/R user [...]] [/P user:perm [...]] [/D user [...]]
file name
|
The name of the file to query for ACL data.
|
/T
|
Changes ACLs of specified files in the current directory and all subdirectories.
|
/M
|
Changes ACLs of volumes mounted to a directory.
|
/L
|
Work on the symbolic link itself versus the target.
|
/S
|
Displays the SDDL string for the DACL.
|
/S:SDDL
|
Replaces the ACLs with those specified in the SDDL string (not valid with /E, /G, /R, /P, or /D).
|
/E
|
Edit ACL instead of replacing it.
|
/C
|
Continue on access denied errors.
|
/G user:perm
|
Grant access rights to user. Perm can be:
R
Read
W
Write
C
Change (write)
F
Full control
|
/R user
|
Revoke specified user's access rights (only valid with /E).
|
/P user:perm
|
Replace the access rights of user. Perm can be:
N
None
R
Read
W
Write
C
Change (write)
F
Full control
|
/D user
|
Deny specified user access.
|
Abbreviations:
CI - Container inherit. The ACE will be inherited by directories.
OI - Object inherit. The ACE will be inherited by files.
IO - Inherit only. The ACE does not apply to the current file or directory.
ID - Inherited. The ACE was inherited from the parent directory's ACL.
CACLS 文件名 [/ T] [/ M] [/ L] [/ S [:SDDL]] [/ E] [/ C] [/ G 用户:perm ]
[/ R用户[...]] [/ P 用户:烫发 [...] [/ D用户[...]]
Windows XP和更早的语法
显示或修改文件的ACL(访问控制列表)。
CACLS file name [/T] [/E] [/C] [/G user:perm] [/R user [...]]
[/P user:perm [...]] [/D user [...]]
file name
|
查询ACL数据的文件名。
|
/T
|
更改当前目录和所有子目录中指定文件的ACL。
|
/E
|
编辑ACL而不是替换它。
|
/C
|
继续进行访问被拒绝的错误。
|
/G user:perm
|
赋予指定用户访问权限:
W
读取
C
更改 (写入)
F
完全控制
|
/R user
|
撤销指定用户的访问权限(仅在与 /E 一起使用时合法)。
|
/P user:perm
|
替换指定用户的访问权限 :
R
读取
W
写入
C
更改(写入)
F
完全控制
|
/D user
|
拒绝指定的用户访问。
|
通配符可以在命令中指定多个文件。 您可以在一个命令中指定多个用户。
Displays or modifies ACLs (access control lists) of files.
CACLS file name [/T] [/E] [/C] [/G user:perm] [/R user [...]]
[/P user:perm [...]] [/D user [...]]
file name
|
The name of the file to query for ACL data.
|
/T
|
Changes ACLs of specified files in the current directory and all subdirectories.
|
/E
|
Edit ACL instead of replacing it.
|
/C
|
Continue on access denied errors.
|
/G user:perm
|
Grant access rights to user. Perm can be:
W
Write
C
Change (write)
F
Full control
|
/R user
|
Revoke specified user's access rights (only valid with /E).
|
/P user:perm
|
Replace the access rights of user. Perm can be:
R
Read
W
Write
C
Change (write)
F
Full control
|
/D user
|
Deny specified user access.
|
Wildcards can specify more than one file in a command. You can specify more than one user in a command.
Cacls 示例
cacls myfile.txt
上面的命令显示文件输出示例:
READ_CONTROL
FILE_READ_EA
FILE_EXECUTE
FILE_DELETE_CHILD
BUILTINAdministrators:F
Computer-NameNone:R
NT AUTHORITYSYSTEM:(special access:)
READ_CONTROL
SYNCHRONIZE
FILE_GENERIC_READ
FILE_GENERIC_WRITE
BUILTINAdministrators:(special access:)
READ_CONTROL
SYNCHRONIZE
FILE_GENERIC_READ
Everyone:R
cacls myfile.txt / e / g mrhope:f
上面的命令为用户mrhope授予文件myfile.txt的完全权限(f)。如果随后列出了文件的ACL(例如,使用上面的第一个命令),则用户mrhope出现在列表中。
cacls myfile.txt
The command above displays the ACLs for the file myfile.txt. Example
output:
READ_CONTROL
FILE_READ_EA
FILE_EXECUTE
FILE_DELETE_CHILD
BUILTINAdministrators:F
Computer-NameNone:R
NT AUTHORITYSYSTEM:(special access:)
READ_CONTROL
SYNCHRONIZE
FILE_GENERIC_READ
FILE_GENERIC_WRITE
BUILTINAdministrators:(special access:)
READ_CONTROL
SYNCHRONIZE
FILE_GENERIC_READ
Everyone:R
cacls myfile.txt / e / g mrhope:f
The command above grants the user mrhope full rights (f) to the file myfile.txt. If the ACL for the file is then listed (for instance, using the first command above), the user mrhope appears in the list.