英文:
Find if current user is Admistrator
问题
有没有办法找出当前执行应用程序的用户是否是管理员?
我在 http://golang.org/pkg/os/user/ 上查找了一下,没有找到关于权限的任何信息。
英文:
Is there a way of finding if the current user executing the application is an Administrator?
I looked around http://golang.org/pkg/os/user/ and couldn't find anything about Permissions.
答案1
得分: 1
这更多是一个特定于操作系统的问题。我假设你在谈论Windows,所以我查了一下:http://support.microsoft.com/kb/243330
这篇文章说管理员的SID是:'S-1-5-32-544'。这意味着如果用户在Administrators组中,user.Gid的值将是这个。
此外,似乎还有一个特殊的系统管理员SID为S-1-5-21domain-500。
英文:
This is more of an OS specific question. I assume you are talking about Windows so I looked up: http://support.microsoft.com/kb/243330
This says that the SID of administrators is: 'S-1-5-32-544'. This means that the user.Gid will be that value if in group Administrators.
Also there seems to be a special System Administrator SID of S-1-5-21domain-500.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论