It appears that in order for a client (running under lower privilege rights) to open a named pipe, they must have FILE_READ_ATTRIBUTES and SYNCHRONIZE access, so be sure to grant this access to any users you want to be able to connect.
Here's some code (C++) on how to do this:
------------------------------------------------------------------------------------------------------------------
// Create a pipe
hPipe = CreateNamedPipe(L\\\\.\\pipe\\MyPipeNameHere, PIPE_ACCESS_OUTBOUND | WRITE_DAC,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_NOWAIT, 1,
1024, 1024, 2000, NULL);
// An ACE must be added to pipe's DACL so that client processes
// running under low-privilege accounts are also able to change state
// of client end of this pipe to Non-Blocking and Message-Mode.
PACL pACL = NULL;
PACL pNewACL = NULL;
EXPLICIT_ACCESS explicit_access_list[1];
TRUSTEE trustee[1];
GetSecurityInfo(hPipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pACL, NULL, NULL);
trustee[0].TrusteeForm = TRUSTEE_IS_NAME;
trustee[0].TrusteeType = TRUSTEE_IS_GROUP;
trustee[0].ptstrName = L"Everyone";
trustee[0].MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
trustee[0].pMultipleTrustee = NULL;
ZeroMemory(&explicit_access_list[0],
sizeof(EXPLICIT_ACCESS));
explicit_access_list[0].grfAccessMode = GRANT_ACCESS;
explicit_access_list[0].grfAccessPermissions = FILE_WRITE_ATTRIBUTES;
explicit_access_list[0].grfInheritance = NO_INHERITANCE;
explicit_access_list[0].Trustee = trustee[0];
SetEntriesInAcl(1, explicit_access_list, pACL, &pNewACL);
SetSecurityInfo(hPipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, pNewACL, NULL);
LocalFree(pNewACL);
------------------------------------------------------------------------------------------------------------------
NOTE: Denying access to named pipe from remote users can be done with the same code as above. Just replace L"Everyone" with L"Network" with changes to grfAccessMode and grfAccessPermissions.
Code on this post is added by Sanje2v. Original post and/or last editor was Joseph Galbraith.