microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.23k stars 8.27k forks source link

Can't run Windows Terminal without Administrator #13197

Open LoganDark opened 2 years ago

LoganDark commented 2 years ago

Windows Terminal version

1.13.11431.0

Windows build number

10.0.19041.572

Yes, this has actually downgraded since my last bug report. Blame the fact that I had limited download options.

Other Software

No response

Steps to reproduce

See https://github.com/microsoft/terminal/issues/13099#issuecomment-1138459416 and the comments leading up to it.

  1. I was given a command that completely ruined every app on my system.
  2. I had to do an in-place upgrade to fix the issue.
  3. Windows Terminal, through any amount of reinstalls, now cannot run without Administrator.

Expected Behavior

No response

Actual Behavior

Windows Terminal, through any amount of reinstalls, now cannot run without Administrator. I also cannot double-click the msixbundle to install (I get some permission error), but Add-AppxPackage works.

The wt command is not found in a non-Administrator Command Prompt, but it is found in an Administrator Command Prompt.

No Start Menu entries work for any part of Windows Terminal, not even the shortcuts, unless run as Administrator.

lonnywong commented 2 years ago

I reset UAC and reboot, and it works for me.

LoganDark commented 2 years ago

I reset UAC and reboot, and it works for me.

What do you mean "reset UAC"?

Do you mean turning this slider to the very bottom?

image

lonnywong commented 2 years ago

"reset" means I didn't change the level.

Mine is "Never notify", I click it, and then click "OK", and then it said I need to reboot. It works after reboot.

Btw, I change the level to default, and reboot again, it works too.

LoganDark commented 2 years ago

"reset" means I didn't change the level.

That's a weird way to use the words, but OK.

Mine is "Never notify"

Well, I don't want to nullify all security on my computer. There's a reason UAC exists.

lonnywong commented 2 years ago

I'm using the default level, and it works.

I think you can set it to any level, just set it again. Click it to make it saying you need to restart the computer.

lonnywong commented 2 years ago
  1. open the UAC.
  2. click the level. No matter which level you are using, and you don't need to change it, just click it.
  3. Click OK. You should getting "restart the computer".
  4. Reboot the computer. It should work.
LoganDark commented 2 years ago

3. You should getting "restart the computer".

I'm actually not for some reason? I can change the level all I want without restarting. Even completely disable it and re-enable it again and the changes apply instantly (i.e. it's not asking me to reboot). Should I just reboot anyway after messing with it?

lonnywong commented 2 years ago

It must be a bug. I can't reproduce it now. Maybe you should try to reboot anyway.

LoganDark commented 2 years ago

Rebooted my computer again, still can't open Windows Terminal without administrator. :/

lonnywong commented 2 years ago

Sorry for not helping. I have the same issue before, and happened to solve it yesterday.

zadjii-msft commented 2 years ago

\

We need a better way of reporting these issues to the appx team - We simply don't have the debugging knowhow to investigate these properly.

Trugamr commented 2 years ago

Make sure in settings.json, profile settings don't have elevate: true setting.

LoganDark commented 2 years ago

Make sure in settings.json, profile settings don't have elevate: true setting.

There is no elevate anywhere in my settings.json

LoganDark commented 2 years ago

woah, I have no idea how that got clicked, I used ctrl+enter to comment

JonathanPitre commented 1 year ago

Same issue here when I run Terminal (Admin) with a non-admin account and input my admin creds. Even with the Terminal Preview version,

Is this being looked into? This a fresh build of Windows 11 22H2.

LoganDark commented 1 year ago

Okay, does this have something to do with it?

image

I guess this must've happened when I reinstalled Windows. Except... from an admin command prompt.. it is still 0 bytes and yet executes just fine

image

Huh?!

image

zadjii-msft commented 1 year ago

@LoganDark Nope, those are App Execution Aliases, which are reparse points, which the OS does a really bad job of telling you what they mean. pwsh is at least a little better

LoganDark commented 1 year ago

@LoganDark Nope, those are App Execution Aliases, which are reparse points, which the OS does a really bad job of telling you what they mean. pwsh is at least a little better

Is there any way to figure out why non-administrators cannot execute them?

zadjii-msft commented 1 year ago

why non-administrators cannot execute them?

I mean, the reparse point isn't an executable itself. It's just like, a symlink, that points at the actual exe. Trick is, that AEA's for Store apps point at an exe on the filesystem that has super restricted permissions, such that even admins can't execute it normally. However, there's a magic handoff in CreateProcess that knows how to delegate the creation of a packaged process to the right set of ACLs. It's a process I don't fully understand, to be totally honest. That magic lets apps run with special store-granted permissions only, but from the user context it seems like nothing weird happened

It's definitely weird, though, that you can't run the Terminal without admin permissions. That's unexpected. Does that repro for any other Store apps? Like, maybe Ubuntu.exe? (I'm sure there are plenty of other Store apps that are "centennial" apps that request the normal level of permissions)

LoganDark commented 1 year ago

I mean, the reparse point isn't an executable itself. It's just like, a symlink, that points at the actual exe.

Yeah, I understand what you mean. You still execute them in order to do the reparse magic, though.

It's definitely weird, though, that you can't run the Terminal without admin permissions. That's unexpected. Does that repro for any other Store apps? Like, maybe Ubuntu.exe? (I'm sure there are plenty of other Store apps that are "centennial" apps that request the normal level of permissions)

The python.exe standin that opens the Microsoft Store also only works from an admin command prompt. App Installer also does not work without being granted admin, so for example, I can't double-click appxbundles to install, I have to use Add-AppxPackage.

However, since the in-place reinstall, built-in apps like Alarms & Clock or Calendar work just fine.

zadjii-msft commented 1 year ago

The python.exe standin that opens the Microsoft Store also only works from an admin command prompt ... built-in apps like Alarms & Clock or Calendar work just fine.

Okay yea this is definitely a Centennial issue then. Alarms&Clock, Calendar, Calculator - these are all apps that run in an app container. That's fundamentally different than Terminal, Python, WSL distros, etc, which do not have an app container.

We need to connect you up with someone on the appx/msix/deployment team to help investigate this, cause this is definitely not something we (the Terminal team) are equipped to debug.

LoganDark commented 1 year ago

The python.exe standin that opens the Microsoft Store also only works from an admin command prompt ... built-in apps like Alarms & Clock or Calendar work just fine.

Okay yea this is definitely a Centennial issue then. Alarms&Clock, Calendar, Calculator - these are all apps that run in an app container. That's fundamentally different than Terminal, Python, WSL distros, etc, which do not have an app container.

So far I haven't had any issues with accessing WSL, either through Windows Terminal (as admin), bash.exe (WSL 2), or ubuntu2004.exe (WSL 1).

We need to connect you up with someone on the appx/msix/deployment team to help investigate this, cause this is definitely not something we (the Terminal team) are equipped to debug.

I would definitely appreciate that very much, thank you! My email can be found on my GitHub profile. You're welcome to have someone contact me, and if we can find a solution I'll make sure to post it here.

maidamai0 commented 1 year ago

Make sure in settings.json, profile settings don't have elevate: true setting.

There is no elevate anywhere in my settings.json

there are two settings, one for user and one for default, do you check all of them?

LoganDark commented 1 year ago

Make sure in settings.json, profile settings don't have elevate: true setting.

There is no elevate anywhere in my settings.json

there are two settings, one for user and one for default, do you check all of them?

This isn't the issue because running wt.exe directly raises this error

image

spufidoo commented 1 year ago

I have the same issue - I cannot start Windows Terminal outside of Administrator Mode, whether it's Window Terminal Version 1.18.1462.0, or Windows Terminal Preview Version: 1.18.1462.0, which is a real pain. I've just uninstalled both, rebooted, and downloaded Windows Terminal Version: 1.17.11461.0 from the Store - still runs in Admin mode by default.

ttxs69 commented 11 months ago
  1. open the UAC.
  2. click the level. No matter which level you are using, and you don't need to change it, just click it.
  3. Click OK. You should getting "restart the computer".
  4. Reboot the computer. It should work.

This solves my problem, thanks a lot.