C#-如何获得“每个人”用户? [英] C# - How do I get the "Everybody" user?

查看:85
本文介绍了C#-如何获得“每个人”用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个可以创建共享并更改当前用户权限的代码。目标是始终在共享级别上允许所有人,并在ntfs 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.

我使用的是德语窗口,我注意到我只能访问每个人用户使用 jeder。用英语讲,我想是用户所有人还是所有人?无论如何,我正在寻找一种使每个用户语言名称独立的方法。

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.

希望这是可能的。

推荐答案

Windows英文版使用的名称是 所有人

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

通过使用 WellKnownSidType.WorldSid 值:

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

这篇关于C#-如何获得“每个人”用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆