K
K
Konstantin Tsvetkov2022-01-17 16:02:52
Access rights
Konstantin Tsvetkov, 2022-01-17 16:02:52

How to find folders that don't have administrator access?

The question " How to get a list of folders sorted by number... " was asked to find "black holes", i.e. folders owned by SYSTEM and access to which the administrator does not have, only through privilege escalation ( for example ). How to find such folders?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MaxKozlov, 2022-01-17
@tsklab

If you just need to get a list of such folders where the admin is not allowed, then on Powershell

$Error.Clear()
Get-ChildItem C:\ -Recurse -ErrorAction Continue | Out-Null
$err = $Error | ForEach-Object { $_.TargetObject }
After that, the $err variable will contain a list of folders for which errors were generated.
write them to a file
$err | Set-Content -Path d:\Path_without_access.txt -Encoding UTF8

Further, already from under the Elevated Shell, you can get AccessList on them through Get-ACL and somehow do something

R
rPman, 2022-01-17
@rPman

Only by writing your program in some programming language (I do not recommend cmd / bat, regularly in windows there is c# / js # using .net or outdated WSH js / vbs)
There is a cacls utility to get permissions on files (outdated and inconvenient) or icacls
icacls c:\ /save acl_out.txt /t /c
instead of names there will be sid, which you can find out
wmic useraccount get name,sid
allow you to get information about the rights to the specified file or directory in text form
ps everything can be done immediately on powershell but I don’t know how (Google Get-Acl)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question