title: Local System only ACL in Windows
body: <p>I am using a named pipe for communications between two processes and want to restrict acess to any user on the local system in Windows.</p>
  
  <p>I am building up and ACL for use in the SECURITY_ATTRIBUTES passed to CreateNamedPipe.</p>
  
  <p>I am basing this code on that from <a href="http://support.microsoft.com/kb/813414" rel="nofollow noreferrer">Microsoft</a>.</p>
  
  <pre><code>SID_IDENTIFIER_AUTHORITY siaLocal = SECURITY_LOCAL_SID_AUTHORITY;
  if( !AllocateAndInitializeSid( &amp;siaLocal, SECURITY_LOCAL_RID,
      0, 0, 0, 0, 0, 0, 0, 0,
      &amp;pSidLocal ) )
  {
      break;
  }
  </code></pre>
  
  <p>I then use that sid with AddAccessAllowedAce.</p>
  
  <p>All of this completes successfully and I can create the named pipe however when a client process then tries to connect using CreateFile it fails with access denied.</p>
  
  <p>How do I create an ACL with a SID that allows any user of the local machine to access it?</p>