Powershell을 사용하여 파이프라는 이름의 창에 권한을 추가하는 방법은 무엇입니까?

Powershell을 사용하여 파이프라는 이름의 창에 권한을 추가하는 방법은 무엇입니까?

Powershell 스크립트를 사용하여 특정 그룹이 기존 명명된 파이프에서 읽기/쓰기 권한을 추가하려면 어떻게 해야 합니까?

내가 갔던 곳은 이렇다.

$AccessRule = New-Object System.IO.Pipes.PipeAccessRule( "Users", "FullControl", "Allow" )
$PipeSecurity = [System.IO.Directory]::GetAccessControl("\\.\pipe\docker_engine")
$PipeSecurity.AddAccessRule($AccessRule) 

오류 발생

값이 "System.IO.Pipes.PipeAccessRule"인 "AddAccessRule"의 인수 "rule"을 "System.Security.AccessControl.FileSystemAccessRule" 유형으로 변환할 수 없습니다.

답변1

$account="<DOMAIN>\<USERNAME>"
$npipe = "\\.\pipe\docker_engine"                                                                                 
$dInfo = New-Object "System.IO.DirectoryInfo" -ArgumentList $npipe                                               
$dSec = $dInfo.GetAccessControl()                                                                                 
$fullControl =[System.Security.AccessControl.FileSystemRights]::FullControl                                       
$allow =[System.Security.AccessControl.AccessControlType]::Allow                                                  
$rule = New-Object "System.Security.AccessControl.FileSystemAccessRule" -ArgumentList $account,$fullControl,$allow
$dSec.AddAccessRule($rule)                                                                                        
$dInfo.SetAccessControl($dSec)

답변2

Ben의 솔루션은 작동하지만 Docker 데몬이 다시 시작될 때마다 액세스 규칙이 손실됩니다.

그러나 Docker의 경우 영구적인 수정 사항이 있습니다. 다음 내용으로
파일을 만듭니다 .%programdata%\docker\config\daemon.json

{
    "group": "Users"
}

이를 통해 Windows 그룹의 모든 사용자는 Users관리자 권한 없이 명명된 파이프를 열 수 있습니다.

베스트 1월


이것이선적 서류 비치.

-G, --group 문자열 | Unix 소켓 그룹(기본값 "docker")

"유닉스 소켓"이라고 되어 있지만 명명된 파이프에서도 작동합니다.

기본 그룹은 인 것 같지만 docker데몬에 의해 생성되지 않았습니다. 그리고 Docker Desktop은 docker-users.

관련 정보