试图清理IIS6 w / PHP CGI服务器上的权限,似乎有几个文件/文件夹具有写入每个人的权限。 (你可能会反复猜测发生了什么。)
所以,基本上,我正在寻找相当于find $directory -perm 777 -exec ls -ld {} \;
我可以做的第一部分, 列出文件提到 icacls每个人,但似乎无法显示实际的ACL:
icacls \directory /findSID *S-1-1-0 /t
看着subinacl文档和各种谷歌的结果,似乎我可以使用/子目录和/显示来实现这一点,但它立即返回没有结果,没有错误:
C:\>subinacl /subdirectories \directory\*.* /findsid=Everyone /display +subdirectories \directory\*.* /findsid=Everyone /display Elapsed Time: 00 00:00:00 Done: 0, Modified 0, Failed 0, Syntax errors 0
这对我来说,PowerShell和pstools:
Get-ChildItem C:\temp\ -Recurse | Get-Acl | grep "Everyone"
您可能需要根据自己的需求进一步优化,但PowerShell是要走的路。
Orbitron的build议非常好,但是如果您想要使用纯粹的PowerShell方式而不必安装pstools,请查看select-string cmdlet。 您可能必须先将对象pipe道传送到文件,然后使用select-string将其消耗,或者可以将out-string楔入pipe道。
Get-ChildItem -Recurse | Get-Acl | out-string -stream | select-string -pattern "everyone"