Named pipe client unable to connect to server running as Network Service

前端 未结 2 1575
清酒与你
清酒与你 2021-01-11 23:11

I have a service running under the Network Service account. The service just sets up a named pipe and listens for connections:

NamedPipeServerStream listenin         


        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-11 23:45

    Pipe server is created with the default service DACL so that only the administrator or system user can connect to the pipe. You need to set the pipe server with proper access rules to make all client connection to succeed. Below is the code to set the access rule to access everyone to access the pipe:

        PipeSecurity pipeSa = new PipeSecurity(); 
        pipeSa.SetAccessRule(new PipeAccessRule("Everyone", 
                        PipeAccessRights.ReadWrite, AccessControlType.Allow)); 
        listeningPipe.SetAccessControl(pipeSa);
    

    It always better to define only a minimal set of users to access the pipe server to make it secure.

提交回复
热议问题