Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The name of the Everyone group in non-english OSs

We have an issue with the way we are creating a Mutex. The problem line is:

MutexAccessRule rule = new MutexAccessRule("Everyone", MutexRights.FullControl, AccessControlType.Allow);

The hardcoded "Everyone" string only works on English OSes, how do we change this line so it works in all languages?

like image 775
Sam Saffron Avatar asked Dec 19 '08 22:12

Sam Saffron


People also ask

What is everyone group in Active Directory?

The Everyone group includes all members of the Authenticated Users group as well as the built-in Guest account, and several other built-in security accounts like SERVICE, LOCAL_SERVICE, NETWORK_SERVICE , and others. A Guest account is a built-in account on a Windows system that is disabled by default.

Does the Everyone group include non domain users?

Everyone encompasses all authenticated users (which could be from other domains trusted by the domain SharePoint resides in) where as Domain Users refers to users of just that particular domain.

How do I add a user to authenticated users group?

Click the Security tab and select Authenticated Users (or click Add to add it if it is not already in the Group or user names box).


2 Answers

Google is being helpful today:

Looks like this will help

This code solves this problem:

  SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
  MutexAccessRule rule = new MutexAccessRule(sid, MutexRights.FullControl, AccessControlType.Allow);

VB:

Dim sid As System.Security.Principal.SecurityIdentifier = New System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.WorldSid, Nothing)
Dim rule As System.Security.AccessControl.MutexAccessRule = New System.Security.AccessControl.MutexAccessRule(sid, System.Security.AccessControl.MutexRights.FullControl, System.Security.AccessControl.AccessControlType.Allow)
like image 195
Sam Saffron Avatar answered Sep 22 '22 22:09

Sam Saffron


I had the same problem, but needed the actual localized string of the "Everyone" group name in order to enable access to a MessageQueue. Here's the solution I found, which works fine:

SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
myMessageQueue.SetPermissions(acct.ToString(), MessageQueueAccessRights.FullControl); 
like image 29
blinedale Avatar answered Sep 26 '22 22:09

blinedale