Windows 究竟什么是';以管理员身份运行';做
在Windows7上,我有一个命令行程序由于文件写入权限错误而失败,每次运行来自“未知发布者”的命令行程序时,都会弹出恼人的对话框 但是,如果我通过右键单击并选择“以管理员身份运行”来启动控制台,则安装工作正常,即使UAC对话框仍然存在 我的用户已经是“管理员”组的成员,那么“以管理员身份运行”到底做了什么才能使我的安装工作正常呢 我的具体问题就是:“以管理员身份运行”是做什么的?到目前为止,两个答案都没有提到这一点。(例如,它是以“管理员”用户的身份运行新进程?还是以当前用户的身份运行进程,但具有提升的权限?如果是,有哪些权限?这与我的用户在“管理员”组中获得的权限有何不同Windows 究竟什么是';以管理员身份运行';做,windows,windows-7,privileges,administrator,runas,Windows,Windows 7,Privileges,Administrator,Runas,在Windows7上,我有一个命令行程序由于文件写入权限错误而失败,每次运行来自“未知发布者”的命令行程序时,都会弹出恼人的对话框 但是,如果我通过右键单击并选择“以管理员身份运行”来启动控制台,则安装工作正常,即使UAC对话框仍然存在 我的用户已经是“管理员”组的成员,那么“以管理员身份运行”到底做了什么才能使我的安装工作正常呢 我的具体问题就是:“以管理员身份运行”是做什么的?到目前为止,两个答案都没有提到这一点。(例如,它是以“管理员”用户的身份运行新进程?还是以当前用户的身份运行进程,但
(具体来说,我使用的是来自的“控制台”,而不是常规的CMD窗口,但我认为这并不重要。这是在安装Python“分发”包时,通过在Python.org新安装的Python3 MSI上运行“Python distribute_setup.py”。它是64位Windows上的32位Python。请参阅)Windows 7要求您有意请求某些权限,以便恶意程序不会对您造成不良影响。如果您下载的免费计算器需要以管理员身份运行,您就会知道有问题。有一些操作系统命令可提升应用程序的权限(将请求用户确认) 有关详细说明,请访问:
更新 “以管理员身份运行”只是一个命令,使程序能够继续某些需要管理员权限的操作,而不显示UAC警报 即使您的用户是administrators组的成员,某些应用程序(如您的)也需要管理员权限才能继续运行,因为如果应用程序正在执行某些特殊操作(如编辑系统文件或其他操作),则认为该应用程序不安全。这就是Windows需要管理员权限才能执行的原因e应用程序,它会通知您UAC警报。并非所有应用程序都需要Amnistrator帐户才能运行,有些应用程序(如您的应用程序)需要管理员权限 如果您使用“以管理员身份运行”命令执行应用程序,则您将通知系统您的应用程序是安全的,并在确认后执行需要管理员权限的操作 如果您想避免这种情况,只需在控制面板上禁用UAC
如果您想进一步了解,请阅读Microsoft论坛上的问题或超级用户问题。当您登录Windows时,将创建一个访问令牌。这将标识您、您所属的组以及您的权限。请注意,用户是否为管理员取决于该用户是否为管理员组的成员起来
0: kd> !process 0 1 test.exe
PROCESS 87065030 SessionId: 1 Cid: 0d60 Peb: 7ffdf000 ParentCid: 0618
DirBase: 2f22e1e0 ObjectTable: a0c8a088 HandleCount: 6.
Image: test.exe
VadRoot 8720ef50 Vads 18 Clone 0 Private 83. Modified 0. Locked 0.
DeviceMap 8936e560
Token 935c98e0
0: kd> !token -n 935c98e0
_TOKEN 935c98e0
TS Session ID: 0x1
User: S-1-5-21-2452432034-249115698-1235866470-1000 (no name mapped)
User Groups:
00 S-1-5-21-2452432034-249115698-1235866470-513 (no name mapped)
Attributes - Mandatory Default Enabled
01 S-1-1-0 (Well Known Group: localhost\Everyone)
Attributes - Mandatory Default Enabled
02 S-1-5-32-544 (Alias: BUILTIN\Administrators)
Attributes - Mandatory Default Enabled Owner
03 S-1-5-32-545 (Alias: BUILTIN\Users)
Attributes - Mandatory Default Enabled
04 S-1-5-4 (Well Known Group: NT AUTHORITY\INTERACTIVE)
Attributes - Mandatory Default Enabled
05 S-1-2-1 (Well Known Group: localhost\CONSOLE LOGON)
Attributes - Mandatory Default Enabled
06 S-1-5-11 (Well Known Group: NT AUTHORITY\Authenticated Users)
Attributes - Mandatory Default Enabled
07 S-1-5-15 (Well Known Group: NT AUTHORITY\This Organization)
Attributes - Mandatory Default Enabled
08 S-1-5-5-0-85516 (no name mapped)
Attributes - Mandatory Default Enabled LogonId
09 S-1-2-0 (Well Known Group: localhost\LOCAL)
Attributes - Mandatory Default Enabled
10 S-1-5-64-10 (Well Known Group: NT AUTHORITY\NTLM Authentication)
Attributes - Mandatory Default Enabled
11 S-1-16-12288 (Label: Mandatory Label\High Mandatory Level)
Attributes - GroupIntegrity GroupIntegrityEnabled
Primary Group: S-1-5-21-2452432034-249115698-1235866470-513 (no name mapped)
Privs:
05 0x000000005 SeIncreaseQuotaPrivilege Attributes -
08 0x000000008 SeSecurityPrivilege Attributes -
09 0x000000009 SeTakeOwnershipPrivilege Attributes -
10 0x00000000a SeLoadDriverPrivilege Attributes -
11 0x00000000b SeSystemProfilePrivilege Attributes -
12 0x00000000c SeSystemtimePrivilege Attributes -
13 0x00000000d SeProfileSingleProcessPrivilege Attributes -
14 0x00000000e SeIncreaseBasePriorityPrivilege Attributes -
15 0x00000000f SeCreatePagefilePrivilege Attributes -
17 0x000000011 SeBackupPrivilege Attributes -
18 0x000000012 SeRestorePrivilege Attributes -
19 0x000000013 SeShutdownPrivilege Attributes -
20 0x000000014 SeDebugPrivilege Attributes -
22 0x000000016 SeSystemEnvironmentPrivilege Attributes -
23 0x000000017 SeChangeNotifyPrivilege Attributes - Enabled Default
24 0x000000018 SeRemoteShutdownPrivilege Attributes -
25 0x000000019 SeUndockPrivilege Attributes -
28 0x00000001c SeManageVolumePrivilege Attributes -
29 0x00000001d SeImpersonatePrivilege Attributes - Enabled Default
30 0x00000001e SeCreateGlobalPrivilege Attributes - Enabled Default
33 0x000000021 SeIncreaseWorkingSetPrivilege Attributes -
34 0x000000022 SeTimeZonePrivilege Attributes -
35 0x000000023 SeCreateSymbolicLinkPrivilege Attributes -
Authentication ID: (0,14e4c)
Impersonation Level: Anonymous
TokenType: Primary
Source: User32 TokenFlags: 0x2000 ( Token in use )
Token ID: d166b ParentToken ID: 0
Modified ID: (0, d052f)
RestrictedSidCount: 0 RestrictedSids: 00000000
OriginatingLogonSession: 3e7
如果没有UAC,当您运行一个程序时,它将获得访问令牌的副本,这将控制程序可以访问的内容
使用UAC,当您运行一个程序时,它会获得一个受限访问令牌。这是从组列表中删除“Administrators”的原始访问令牌(以及一些其他更改)。即使您的用户是Administrators组的成员,该程序也不能使用管理员权限
当您选择“以管理员身份运行”并且您的用户是管理员时,程序将使用原始的无限制访问令牌启动。如果您的用户不是管理员,系统将提示您输入管理员帐户,并且程序将在该帐户下运行。类似“提升权限”、“限制访问令牌”之类的内容,“管理员权限”…到底什么是管理员权限?都是胡说八道
这是一个访问令牌,用于通常从属于Administrators组的用户运行的进程
0: kd> !process 0 1 test.exe
PROCESS 87065030 SessionId: 1 Cid: 0d60 Peb: 7ffdf000 ParentCid: 0618
DirBase: 2f22e1e0 ObjectTable: a0c8a088 HandleCount: 6.
Image: test.exe
VadRoot 8720ef50 Vads 18 Clone 0 Private 83. Modified 0. Locked 0.
DeviceMap 8936e560
Token 935c98e0
0: kd> !token -n 935c98e0
_TOKEN 935c98e0
TS Session ID: 0x1
User: S-1-5-21-2452432034-249115698-1235866470-1000 (no name mapped)
User Groups:
00 S-1-5-21-2452432034-249115698-1235866470-513 (no name mapped)
Attributes - Mandatory Default Enabled
01 S-1-1-0 (Well Known Group: localhost\Everyone)
Attributes - Mandatory Default Enabled
02 S-1-5-32-544 (Alias: BUILTIN\Administrators)
Attributes - Mandatory Default Enabled Owner
03 S-1-5-32-545 (Alias: BUILTIN\Users)
Attributes - Mandatory Default Enabled
04 S-1-5-4 (Well Known Group: NT AUTHORITY\INTERACTIVE)
Attributes - Mandatory Default Enabled
05 S-1-2-1 (Well Known Group: localhost\CONSOLE LOGON)
Attributes - Mandatory Default Enabled
06 S-1-5-11 (Well Known Group: NT AUTHORITY\Authenticated Users)
Attributes - Mandatory Default Enabled
07 S-1-5-15 (Well Known Group: NT AUTHORITY\This Organization)
Attributes - Mandatory Default Enabled
08 S-1-5-5-0-85516 (no name mapped)
Attributes - Mandatory Default Enabled LogonId
09 S-1-2-0 (Well Known Group: localhost\LOCAL)
Attributes - Mandatory Default Enabled
10 S-1-5-64-10 (Well Known Group: NT AUTHORITY\NTLM Authentication)
Attributes - Mandatory Default Enabled
11 S-1-16-12288 (Label: Mandatory Label\High Mandatory Level)
Attributes - GroupIntegrity GroupIntegrityEnabled
Primary Group: S-1-5-21-2452432034-249115698-1235866470-513 (no name mapped)
Privs:
05 0x000000005 SeIncreaseQuotaPrivilege Attributes -
08 0x000000008 SeSecurityPrivilege Attributes -
09 0x000000009 SeTakeOwnershipPrivilege Attributes -
10 0x00000000a SeLoadDriverPrivilege Attributes -
11 0x00000000b SeSystemProfilePrivilege Attributes -
12 0x00000000c SeSystemtimePrivilege Attributes -
13 0x00000000d SeProfileSingleProcessPrivilege Attributes -
14 0x00000000e SeIncreaseBasePriorityPrivilege Attributes -
15 0x00000000f SeCreatePagefilePrivilege Attributes -
17 0x000000011 SeBackupPrivilege Attributes -
18 0x000000012 SeRestorePrivilege Attributes -
19 0x000000013 SeShutdownPrivilege Attributes -
20 0x000000014 SeDebugPrivilege Attributes -
22 0x000000016 SeSystemEnvironmentPrivilege Attributes -
23 0x000000017 SeChangeNotifyPrivilege Attributes - Enabled Default
24 0x000000018 SeRemoteShutdownPrivilege Attributes -
25 0x000000019 SeUndockPrivilege Attributes -
28 0x00000001c SeManageVolumePrivilege Attributes -
29 0x00000001d SeImpersonatePrivilege Attributes - Enabled Default
30 0x00000001e SeCreateGlobalPrivilege Attributes - Enabled Default
33 0x000000021 SeIncreaseWorkingSetPrivilege Attributes -
34 0x000000022 SeTimeZonePrivilege Attributes -
35 0x000000023 SeCreateSymbolicLinkPrivilege Attributes -
Authentication ID: (0,14e4c)
Impersonation Level: Anonymous
TokenType: Primary
Source: User32 TokenFlags: 0x2000 ( Token in use )
Token ID: d166b ParentToken ID: 0
Modified ID: (0, d052f)
RestrictedSidCount: 0 RestrictedSids: 00000000
OriginatingLogonSession: 3e7
…这是一个进程的访问令牌,通常由同一用户以“管理员身份运行”运行
如您所见,唯一的区别是令牌ID:
Token ID: d166b ParentToken ID: 0
Modified ID: (0, d052f)
vs
很抱歉,我还不能给这个添加太多的信息,但我仍在挖掘。所以…更多的挖掘,结果是。虽然我运行了一个正常进程和一个“作为管理员”,但我关闭了UAC。将UAC设置为“中”可以让我看到不同的结果。基本上,它都归结为完整性级别,即5 例如,浏览器在低级别(1)上运行,而服务(系统用户)在系统级别(4)上运行。中对所有内容都进行了很好的解释。启用UAC时,进程创建为中等级别(添加了SID S-1-16-8192 AKA 0x2000),而在“以管理员身份运行”时,进程创建为高级别(SID S-1-16-12288 AKA 0x3000) 因此,正常用户(中等完整性级别)的正确访问令牌为: 现在,区别如下:
S-1-5-32-544
Attributes - Mandatory Default Enabled Owner
对于“作为管理员”,而
对于非管理员
请注意,S-1-5-32-544是内置的\Administrators。此外,权限较少,最重要的是要注意:
管理员:
S-1-16-12288
Attributes - GroupIntegrity GroupIntegrityEnabled
而对于非管理员:
S-1-16-8192
Attributes - GroupIntegrity GroupIntegrityEnabled
我希望这有帮助
进一步阅读:runas*anywhere命令可使您避免以使用runas命令的用户身份注销和登录 程序要求此提升权限的原因始于Black Comb和Panther文件夹。除非通过管理员提示,否则在windows中对内核的访问权限为0,然后它只是与O/S内核的虚拟关系
好极了!更清楚一点……拥有内核模式访问权限的软件程序可以完全访问计算机的所有数据及其硬件 由于Windows Vista,Microsoft已停止任何和所有I/O进程再次直接访问内核(0环)。最接近的是文件夹crea
S-1-5-32-544
Attributes - DenyOnly
S-1-16-12288
Attributes - GroupIntegrity GroupIntegrityEnabled
S-1-16-8192
Attributes - GroupIntegrity GroupIntegrityEnabled