“以管理员身份运行"究竟是做什么的? [英] What precisely does 'Run as administrator' do?

查看:31
本文介绍了“以管理员身份运行"究竟是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 7 上,我有一个命令行程序由于文件写入权限错误而失败,并弹出烦人的 UAC 对话框.

On Windows 7, I have a command-line program that fails due to file write permission errors, and popping up annoying UAC dialogs every time I run command-line programs that are from an 'unknown publisher'.

但是,如果我通过右键单击并选择以管理员身份运行"来启动我的控制台,那么即使 UAC 对话框仍然存在,安装也会正常运行.

However, if I start my console by right clicking and choosing 'run as administrator', then the install works fine, even if the UAC dialogs are still present.

我的用户已经是管理员"组的成员,那么以管理员身份运行"究竟做了什么才能使我的安装工作?

My user is already a member of the 'administrators' group, so what precisely does 'run as administrator' do that makes my install work?

我的具体问题恰恰是:以管理员身份运行"有什么作用?到目前为止,这两个答案都没有解决这个问题.(例如,它是以管理员"用户身份运行新进程吗?还是以当前用户身份运行该进程,但具有提升的特权?如果是这样,什么特权?这与我从我的用户是否属于管理员"组?

My specific question is precisely: What does 'run as administrator' do? Neither of the answers thus far address this. (for example, does it run the new process as the 'Administrator' user? Or does it run the process as the current user, but with elevated privileges? If so, what privileges? How does that differ from the privileges I get from my user being in the 'Administrators' group?

(具体来说,我使用的是来自 SourceForge 的控制台",而不是常规 CMD窗口,但我认为这并不重要.这是通过在来自 python.org 的新安装的 Python3 MSI 上运行pythondistribute_setup.py"来安装 Pythondistribute"包时完成的.它是 64 上的 32 位 Python位 Windows.请参阅 在 Windows 7 上安装 Python 和分发会给出Writing failed ... permission denied")

(Specifically, I'm using the 'Console' from SourceForge, not a regular CMD window, but I don't think that's important. This is all while installing the Python 'distribute' package by running 'python distribute_setup.py' on a newly installed Python3 MSI from python.org. It's a 32-bit Python on 64-bit Windows. See Installing Python and distribute on Windows 7 gives "Writing failed ... permission denied")

推荐答案

当您登录 Windows 时会创建一个访问令牌.这可以识别您、您所属的组以及您的权限.需要注意的是,用户是否是管理员是由用户是否是Administrators组的成员来决定的.

When you log on Windows creates an access token. This identifies you, the groups you are a member of and your privileges. And note that whether a user is an administrator or not is determined by whether the user is a member of the Administrators group.

如果没有 UAC,当您运行程序时,它会获取访问令牌的副本,这将控制程序可以访问的内容.

Without UAC, when you run a program it gets a copy of the access token, and this controls what the program can access.

使用 UAC,当您运行程序时,它会获得一个受限访问令牌.这是从组列表中删除管理员"的原始访问令牌(以及一些其他更改).即使您的用户是管理员组的成员,该程序也不能使用管理员权限.

With UAC, when you run a program it gets a restricted access token. This is the original access token with "Administrators" removed from the list of groups (and some other changes). Even though your user is a member of the Administrators group, the program can't use Administrator privileges.

当您选择以管理员身份运行"并且您的用户是管理员时,程序将使用原始的无限制访问令牌启动.如果您的用户不是管理员,系统会提示您输入管理员帐户,并且程序在该帐户下运行.

When you select "Run as Administrator" and your user is an administrator the program is launched with the original unrestricted access token. If your user is not an administrator you are prompted for an administrator account, and the program is run under that account.

这篇关于“以管理员身份运行"究竟是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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