Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run as administrator profiles do not run until terminal is ran as administrator. #13675

Open
SomeDudex64 opened this issue Aug 4, 2022 · 6 comments
Labels
Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Milestone

Comments

@SomeDudex64
Copy link

Windows Terminal version

1.14.1963.0

Windows build number

10.0.22000.832

Other Software

No response

Steps to reproduce

  1. Log in to windows as a standard user without administrative permissions
  2. Create a new profile and configure it to run as administrator.
  3. Save the settings and try to run the profile

Expected Behavior

When the profile is ran under the standard non-admin account, the system should prompt the user for administrator credentials. Once the credentials are entered, the profile should run in a new windows with administrator permissions.

Actual Behavior

After entering credentials to the user account control prompt, the profile does not run. Instead it's execution (and appearance of its windows) is delayed until a new instance of terminal is ran as administrator.

This issue does not affect administrator accounts, it only occurs for accounts that are not in the administrators group.

@SomeDudex64 SomeDudex64 added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Aug 4, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 4, 2022
@zadjii-msft
Copy link
Member

Instead it's execution (and appearance of its windows) is delayed until a new instance of terminal is ran as administrator.

Wait like, a new window for the Terminal doesn't just open itself? And you need to go manually start the Terminal as admin, and when you do that, the previously requested elevated profile also launches? That's super weird.

Could you share your settings.json file/?

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 4, 2022
@SomeDudex64
Copy link
Author

Sure, here it is.
settings.zip

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 5, 2022
@SpyassL

This comment was marked as off-topic.

@zadjii-msft
Copy link
Member

settings, without schemes
{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "alwaysShowNotificationIcon": true,
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
    "profiles": 
    {
        "defaults": 
        {
            "experimental.retroTerminalEffect": true,
            "useAcrylic": true
        },
        "list": 
        [
            {
                "colorScheme": "Campbell Powershell",
                "cursorShape": "filledBox",
                "experimental.retroTerminalEffect": true,
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell",
                "useAcrylic": true
            },
            {
                "colorScheme": "Vintage",
                "cursorShape": "underscore",
                "experimental.retroTerminalEffect": true,
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt",
                "opacity": 50,
                "padding": "8"
            },
            {
                "colorScheme": "Solarized Dark",
                "experimental.retroTerminalEffect": true,
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure",
                "useAcrylic": true
            },
            {
                "cursorShape": "emptyBox",
                "experimental.retroTerminalEffect": true,
                "guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
                "hidden": true,
                "name": "Debian",
                "source": "Windows.Terminal.Wsl",
                "useAcrylic": true
            },
            {
                "colorScheme": "One Half Dark",
                "commandline": "%windir%\\py.exe",
                "experimental.retroTerminalEffect": true,
                "guid": "{6459c186-a8e1-4185-91df-ab3fac03383e}",
                "icon": "C:\\Windows\\py.exe,0",
                "name": "Python 3.9",
                "tabTitle": "Python 3.9 Interpreter",
                "useAcrylic": true
            },
            {
                "guid": "{330eddfb-6ba7-562d-b414-f8bb158e0397}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{dc6bfe40-35f4-5de7-b308-60f79c5e3d2f}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "graceful",
                "colorScheme": "Vintage",
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "cursorHeight": 25,
                "cursorShape": "vintage",
                "elevate": true,
                "experimental.retroTerminalEffect": false,
                "font": 
                {
                    "face": "Source Code Pro",
                    "size": 12,
                    "weight": 990
                },
                "guid": "{6c1e9995-d63e-4ce5-9956-2daec99a88a7}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name": "Command Prompt (Administrator)",
                "opacity": 50,
                "padding": "8",
                "snapOnInput": true,
                "startingDirectory": "C:\\",
                "useAcrylic": false
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "graceful",
                "colorScheme": "Vintage",
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "cursorShape": "underscore",
                "elevate": true,
                "experimental.retroTerminalEffect": true,
                "font": 
                {
                    "face": "Cascadia Mono",
                    "size": 12
                },
                "guid": "{ebd04fa3-78ce-434c-8149-67a3994032b8}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name": "Command Prompt (Copy)",
                "opacity": 50,
                "padding": "8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%"
            }
        ]
    },

    "tabWidthMode": "titleLength",
    "useAcrylicInTabRow": true
}

Nothing too interesting other than just the "elevate": true, CMD profile. Hmm. Maybe this is something weird with the app catalog.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Product-Terminal The new Windows Terminal. Priority-2 A description (P2) and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 12, 2022
@zadjii-msft zadjii-msft added this to the 22H2 milestone Aug 12, 2022
@iDolmatov
Copy link

iDolmatov commented Jan 26, 2023

As I understand it, the problem is directly related to the crash.
If a program tries to run an elevated instance, a dump is created. If the same command is executed in the system (run menu), then the profile is launched.
WindowsTerminal_dmp.zip
settings.zip
"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10232.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe" --profile "{8f569650-577b-4062-9904-b4036d680942}"

@iDolmatov
Copy link

Maybe the elevation code through elevate-shim.exe isn't good enough. I ran this program directly with elevated rights to the TrustedInstaller level (system profile), on behalf of System. I also got a program crash.
The user does not have rights to run elevate-shim.exe, so he artificially elevated the rights with a third-party program. It successfully launches directly an elevated terminal (with UAC) without requiring administrator privileges at startup. The test shows that elevating the rights to the system level causes the terminal to crash.

"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.16.10232.0_x64__8wekyb3d8bbwe\elevate-shim.exe"
 new-tab --profile "{8f569650-577b-4062-9904-b4036d680942}"

As far as I understand, such a launch raises the rights above UAC, tk. access to this program is required. This "breaks" the launch of the terminal.

@zadjii-msft zadjii-msft modified the milestones: 22H2, Backlog Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants