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

2

20

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.

Airhead answered 16/2, 2011 at 7:58 Comment(0)
H
35

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)); 
Hagood answered 16/2, 2011 at 8:15 Comment(0)
E
2

I believe the way to do it has been answered here: How can I get the local group name for guests/administrators ?

This "everyone" SID is a well known SID "S-1-1-0" (the list is availalble here: Well-known security identifiers in Windows operating systems).

Exhortation answered 16/2, 2011 at 8:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.