Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - How do I get the "Everybody" user? [duplicate]

Tags:

c#

acl

I already wrote a code which can create a share and change permissions for the current user. The goal was to always allow all for everybody on share level and deny rights on ntfs acl level.

I use a german windows and I noticed that I only can access the everybody user by using "jeder". In english it would be the user "everybody" or "all" I think?! Anyway I'm searching for a way to get the name of the everybody user language independent.

Hope this is possible.

like image 600
fpdragon Avatar asked Feb 16 '11 07:02

fpdragon


1 Answers

The name that the English version of Windows uses is "Everyone".

You can get the user regardless of language by using the WellKnownSidType.WorldSid value:

var sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var account = (NTAccount) sid.Translate(typeof(NTAccount)); 
like image 73
Mark Cidade Avatar answered Oct 17 '22 19:10

Mark Cidade