67

Windows 7では、ファイルの書き込み許可エラーが原因で失敗するコマンドラインプログラムがあり、「不明な発行元」からのコマンドラインプログラムを実行するたびに迷惑なUACダイアログがポップアップ表示されます。

ただし、右クリックして[管理者として実行]を選択してコンソールを起動すると、UACダイアログがまだ表示されている場合でも、インストールは正常に機能します。

私のユーザーはすでに「administrators」グループのメンバーですが、「管理者として実行」すると、インストールが機能するようになりますか?

私の具体的な質問は正確です:「管理者として実行」は何をしますか?これまでのところ、どちらの回答もこれに対応していません。(たとえば、新しいプロセスを「管理者」ユーザーとして実行しますか?それとも、プロセスを現在のユーザーとして実行しますが、昇格された特権を使用しますか?その場合、どの特権ですか?それは私が取得した特権とどのように異なりますか?ユーザーは「管理者」グループに属していますか?

(具体的には、通常のCMDウィンドウではなくSourceForgeの「Console」を使用していますが、それは重要ではないと思います。これは、Pythonの「distribute」パッケージを「pythondistribute_setup.py」で実行してインストールするときにすべてです。 python.orgから新しくインストールされたPython3MSI。64ビットWindowsでは32ビットPythonです。「PythonのインストールとWindows7での配布」を参照してください。「書き込みに失敗しました...権限が拒否されました」

4

8 に答える 8

108

Windowsにログオンすると、アクセストークンが作成されます。これにより、あなた、あなたがメンバーになっているグループ、およびあなたの特権が識別されます。また、ユーザーが管理者であるかどうかは、ユーザーがAdministratorsグループのメンバーであるかどうかによって決まることに注意してください。

UACがない場合、プログラムを実行すると、アクセストークンのコピーが取得され、プログラムがアクセスできる対象が制御されます。

UACを使用すると、プログラムを実行すると、制限付きアクセストークンを取得します。これは、グループのリストから「管理者」が削除された元のアクセストークンです(およびその他の変更)。ユーザーがAdministratorsグループのメンバーであっても、プログラムは管理者権限を使用できません。

「管理者として実行」を選択し、ユーザーが管理者である場合、プログラムは元の無制限のアクセストークンで起動されます。ユーザーが管理者でない場合は、管理者アカウントの入力を求められ、プログラムはそのアカウントで実行されます。

于 2012-01-24T13:58:55.260 に答える
10

だから...もっと掘り下げて、結果を出します。通常のプロセスと「管理者として」のプロセスを1つずつ実行しましたが、UACをオフにしたようです。UACを中程度にすると、さまざまな結果を確認できました。基本的に、それはすべて完全性レベルである5に要約されます。

たとえば、ブラウザは低レベル(1)で実行され、サービス(システムユーザー)はシステムレベル(4)で実行されます。すべては、 Windows整合性メカニズムデザインで非常によく説明されています。UACが有効になっている場合、プロセスは中レベル(SID S-1-16-8192 AKA 0x2000が追加されます)で作成され、「管理者として実行」の場合、プロセスは高レベル(SID S-1-16-12288別名)で作成されます。 0x3000)。

したがって、通常のユーザー(中程度の整合性レベル)の正しいACCESS_TOKENは次のとおりです。

0:000:x86> !token
Thread is not impersonating. Using process token...
TS Session ID: 0x1
User: S-1-5-21-1542574918-171588570-488469355-1000
Groups:
 00 S-1-5-21-1542574918-171588570-488469355-513
    Attributes - Mandatory Default Enabled
 01 S-1-1-0
    Attributes - Mandatory Default Enabled
 02 S-1-5-32-544
    Attributes - DenyOnly
 03 S-1-5-32-545
    Attributes - Mandatory Default Enabled
 04 S-1-5-4
    Attributes - Mandatory Default Enabled
 05 S-1-2-1
    Attributes - Mandatory Default Enabled
 06 S-1-5-11
    Attributes - Mandatory Default Enabled
 07 S-1-5-15
    Attributes - Mandatory Default Enabled
 08 S-1-5-5-0-1908477
    Attributes - Mandatory Default Enabled LogonId
 09 S-1-2-0
    Attributes - Mandatory Default Enabled
 10 S-1-5-64-10
    Attributes - Mandatory Default Enabled
 11 S-1-16-8192
    Attributes - GroupIntegrity GroupIntegrityEnabled
Primary Group:   LocadDumpSid failed to dump Sid at addr 000000000266b458, 0xC0000078; try own SID dump.
s-1-0x515000000
Privs:
 00 0x000000013 SeShutdownPrivilege               Attributes -
 01 0x000000017 SeChangeNotifyPrivilege           Attributes - Enabled Default
 02 0x000000019 SeUndockPrivilege                 Attributes -
 03 0x000000021 SeIncreaseWorkingSetPrivilege     Attributes -
 04 0x000000022 SeTimeZonePrivilege               Attributes -
Auth ID: 0:1d1f65
Impersonation Level: Anonymous
TokenType: Primary
Is restricted token: no.

現在、違いは次のとおりです。

S-1-5-32-544
Attributes - Mandatory Default Enabled Owner

「管理者として」の場合、

S-1-5-32-544
Attributes - DenyOnly

非管理者向け。

S-1-5-32-544はBUILTIN\Administratorsであることに注意してください。また、特権が少なく、注意すべき最も重要なことは次のとおりです。

管理者:

S-1-16-12288
Attributes - GroupIntegrity GroupIntegrityEnabled

非管理者の場合:

S-1-16-8192
Attributes - GroupIntegrity GroupIntegrityEnabled

これがお役に立てば幸いです。

さらに読む:http ://www.blackfishsoftware.com/blog/don/creating_processes_sessions_integrity_levels

于 2013-03-19T10:08:53.067 に答える
3

アップデート

「管理者として実行」は単なるコマンドであり、プログラムがUACアラートを表示せずに、管理者権限を必要とするいくつかの操作を続行できるようにします。

ユーザーが管理者グループのメンバーであっても、システムファイルの編集などの特別な操作を実行している場合、アプリケーションは安全でないと見なされるため、実行を継続するには管理者権限が必要なアプリケーションもあります。これが、Windowsがアプリケーションを実行するために管理者特権を必要とし、UACアラートで通知する理由です。すべてのアプリケーションを実行するためにAmnistratorアカウントが必要なわけではなく、あなたのような一部のアプリケーションには管理者権限が必要です。

「管理者として実行」コマンドを使用してアプリケーションを実行すると、アプリケーションが安全であることをシステムに通知し、確認を使用して管理者権限を必要とする処理を実行します。

これを回避したい場合は、コントロールパネルでUACを無効にするだけです。

さらに詳しく知りたい場合は、Microsoftフォーラムの「管理者として実行」とWindows7管理者グループの違いに関する質問またはこのスーパーユーザーの質問をお読みください。

于 2012-01-24T13:18:39.010 に答える
1

「特権を昇格させる」、「制限付きアクセストークン」、「管理者特権」などのようなもの...とにかく管理者特権とは一体何ですか?ナンセンスです。

これは、Administratorsグループに属するユーザーから通常実行されるプロセスのACCESS_TOKENです。

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

...これは、「管理者として実行」を使用して同じユーザーによって通常実行されるプロセスのACCESS_TOKENです。

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: ce282            ParentToken ID: 0
Modified ID:               (0, cddbd)
RestrictedSidCount: 0      RestrictedSids: 00000000
OriginatingLogonSession: 3e7

ご覧のとおり、唯一の違いはトークンIDです。

Token ID: d166b            ParentToken ID: 0
Modified ID:               (0, d052f)

vs

Token ID: ce282            ParentToken ID: 0
Modified ID:               (0, cddbd)

申し訳ありませんが、まだこれに多くの光を加えることはできませんが、私はまだ掘っています。

于 2013-03-14T12:31:01.037 に答える
0

Windows 7では、悪意のあるプログラムがあなたに悪いことをしないように、意図的に特定の特権を要求する必要があります。ダウンロードした無料の計算機を管理者として実行する必要がある場合は、何かが稼働していることがわかります。アプリケーションの特権を上げるためのOSコマンドがあります(ユーザーからの確認を要求します)。

良い説明は次の場所にあります。

http://msdn.microsoft.com/en-us/magazine/cc163486.aspx#S4

于 2012-01-24T12:50:04.467 に答える
0

Run as * Anythingコマンドを使用すると、runasコマンドを使用するユーザーとしてログアウトおよびログインする必要がなくなります。

プログラムがこの昇格された特権を要求する理由は、BlackCombとPantherフォルダーから始まりました。管理者プロンプトを介さない限り、Windowsのカーネルへのアクセスは0であり、それはO/Sカーネルとの仮想関係にすぎません。

フーラ!

于 2015-08-19T16:29:20.940 に答える
0

もう少し明確に...カーネルモードにアクセスできるソフトウェアプログラムは、コンピュータのすべてのデータとそのハードウェアに完全にアクセスできます。

Windows Vista以降、Microsoftは、すべてのI / Oプロセスがカーネル(リング0)に直接アクセスすることを再び停止しました。最も近いのは、仮想カーネルアクセスパーティションとして作成されたフォルダーですが、技術的にはカーネル自体へのアクセスはありません。カーネルは途中で出会う。

これは、ソフトウェア自体が使用するトークンを決定するためです。したがって、管理者アクセストークンを要求された場合、Windows XPのようにカーネルとの通信を許可するのではなく、毎回カーネルへのアクセスを許可するように求められます。UACを変更するとプロンプトが減る可能性がありますが、カーネルプロンプトは減りません。

管理者としてログインしている場合でも、所有する権限を昇格するように求められるまで、標準ユーザーとしてプロセスを実行しています。管理者がクレデンシャルを入力する手間を省くためにログインしたと思います。ただし、管理者ユーザーのフォルダー構造にも書き込みます。

カーネルアクセスは、Linuxのrootアクセスに似ています。権限を上げると、C:\のルートから自分自身を隔離し、そこに含まれている素敵な環境変数をすべて隔離します。

BSODを覚えているなら、これは悪いI/Oがカーネルに到達したと信じたときにOSがシャットダウンしたことでした。

于 2015-08-19T17:26:33.503 に答える
0

さて、繰り返しましょう...

実際の質問(そしてその点で優れた質問)

「「管理者として実行」は、管理者グループのメンバーではないことを何をしますか?

(回答)1。これにより、ユーザーセッション中に管理者権限を呼び出すことができます。

注:質問は間違って置かれています。1つはコマンドで、もう1つはポリシーを適用するためのグループオブジェクトです。

コマンドプロンプトを開き、と入力しますrunas /?

runasこれにより、コマンドラインで使用できるすべてのスイッチが一覧表示されます。

管理者グループに関しては、これはGPEDITまたはSECPOLに基づいており、ドメイン管理者が存在するかどうか、またはネットワークが存在するかどうかに基づいています。

通常、これらのことにより、管理者グループが影響を受けないコンピューターに制限が適用されます。

質問は

runas adminは、ユーザーが実行しないように実行しますか?

また

管理者グループは、カスタマイズされたユーザーグループができないことを何をしますか?

あなたはリンゴとオレンジを混ぜています。

于 2015-08-20T15:37:16.097 に答える