Answer the question
In order to leave comments, you need to log in
How to set permissions via icacls?
To limit the user's ability to install and run "left" certificates from tokens, the write rights to the %appdata%\Microsoft\SystemCertificates\My\Certificates directory were limited, which did not allow even the inserted tokens to be used, except for what was already written to the folder.
Now it is necessary to make the same restriction, but with the help of a .bat file, through trial and error, I came up with a command like:
icacls %appdata%\Microsoft\SystemCertificates\My\Certificates /deny %username%:(OI)(CI)(W) /T /C /L /Q
C:\Users\seregina\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates NT AUTHORITY\СИСТЕМА:(I)(OI)(CI)(F)
BUILTIN\Администраторы:(I)(OI)(CI)(F)
CompName\seregina:(I)(OI)(CI)(F)
Обязательная метка\Средний обязательный уровень:(NW)
Успешно обработано 1 файлов; не удалось обработать 0 файлов
C:\Users\seregina\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates CompName\seregina:(OI)(CI)(DENY)(W)
NT AUTHORITY\СИСТЕМА:(I)(OI)(CI)(F)
BUILTIN\Администраторы:(I)(OI)(CI)(F)
CompName\seregina:(I)(OI)(CI)(F)
ЦЕНТР ПАКЕТОВ ПРИЛОЖЕНИЙ\Программные или аппаратные сертификаты, смарт-карта:(I)(OI)(CI)(RX)
Обязательная метка\Средний обязательный уровень:(NW)
Успешно обработано 1 файлов; не удалось обработать 0 файлов
C:\Users\seregina\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates CompName\seregina:(OI)(CI)(DENY)(W)
NT AUTHORITY\СИСТЕМА:(I)(OI)(CI)(F)
BUILTIN\Администраторы:(I)(OI)(CI)(F)
CompName\seregina:(I)(OI)(CI)(F)
Обязательная метка\Средний обязательный уровень:(NW)
Успешно обработано 1 файлов; не удалось обработать 0 файлов
Answer the question
In order to leave comments, you need to log in
I did not find a solution to the issue using cmd, I solved the problem using the powershell ban script.
$path = "$env:APPDATA\Microsoft\SystemCertificates\My\Certificates"
$user = "$env:UserName"
$Rights = "Write"
$InheritSettings = "Containerinherit, ObjectInherit"
$PropogationSettings = "None"
$RuleType = "Deny"
$acl = Get-Acl $path
$perm = $user, $Rights, $InheritSettings, $PropogationSettings, $RuleType
$rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $perm
$acl.SetAccessRule($rule)
$acl | Set-Acl -Path $path
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question