开发者

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

开发者 https://www.devze.com 2023-02-11 06:11 出处:网络
This question already has an answer here: How to get the IdentityReference for "Everyone" to create MutexAccessRule on localized systems?
This question already has an answer here: How to get the IdentityReference for "Everyone" to create MutexAccessRule on localized systems? (1 answer) Closed 8 years ago.

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 acces开发者_如何学Cs 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.


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)); 


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消