FluentTerminal icon indicating copy to clipboard operation
FluentTerminal copied to clipboard

Admin rights

Open manzick opened this issue 7 years ago • 32 comments

How can I start terminal with admin rights? As I know UWP app can't start as administrator. For example, I want to install Chocolatey Package Manager, but I see this. image

P.S, Sorry me for my english language. =)

manzick avatar Feb 04 '18 11:02 manzick

I have no idea so far if this can be achieved with the limitations of UWP. You could try this: http://blog.lukesampson.com/sudo-for-windows

Would be nice to know if it works 🤔

felixse avatar Feb 04 '18 11:02 felixse

Centennial Apps can call for admin rights (see Desktop App Converter in the store) so you can maybe elevate to admin rights the Node.js part that calls the commands

manuelelucchi avatar Feb 04 '18 11:02 manuelelucchi

I will have a look at this, but I am afraid this will be a Microsoft exclusive thing.

FYI, there is no node.js running in the background of this App, the SystemTray is using winpty to host the shell processes. Guess I should write down something about the general architecture soon.

felixse avatar Feb 04 '18 11:02 felixse

There are two problems:

  1. This is not supported for UWP FullTrust processes right now (At least not until RS5)
  2. If we start SystemTray elevated every shell would be always elevated. I don't think this would be as intended.

What might work is to further encapsulate TerminalSession in a new process that we start with startInfo.Verb = "runas"; But I'm not 100% sure if this will work, needs some more investigation.

But nevertheless thanks for your effort 😃

felixse avatar Jun 24 '18 14:06 felixse

I'd love to run FluentTerminal as my main console emulator, but not being able to right-click and Run as Administrator is a big drawback.

spurll avatar Aug 22 '18 18:08 spurll

@spurll As a temporary workaround (or, permanent?), I use the following solution: http://blog.lukesampson.com/sudo-for-windows

(as @felixse pointed out in post 2)

hanskokx avatar Aug 22 '18 18:08 hanskokx

We might actually be able to support elevated shells starting with the 1809 update and ConPTY

felixse avatar Aug 22 '18 19:08 felixse

Has anyone found a solution yet?

RichardBronosky avatar Sep 24 '18 19:09 RichardBronosky

So far only the workarounds that were posted here. A real solution is dependent on 1809, which I had no chance to install yet

felixse avatar Sep 28 '18 05:09 felixse

There exists new information within a blog series (originally anwesered within here).

Maybe there are information about how to handle this with UWP.

tobiaskohlbau avatar Nov 12 '18 08:11 tobiaskohlbau

For Chocolatey , you can give access to C:\ProgramData\chocolatey for users in "rigth click chocolatey folder>Properties>Security>Edit>Users>Tick Full Access and save by clicking OK or approving whatever prompt you get

ynsgnr avatar Dec 02 '18 23:12 ynsgnr

I have no idea so far if this can be achieved with the limitations of UWP. You could try this: http://blog.lukesampson.com/sudo-for-windows

Would be nice to know if it works 🤔

sudo for windows works very well

ynsgnr avatar Dec 02 '18 23:12 ynsgnr

For those who have UAC problems with Chocolatey, I highly suggest you try this: scoop - https://github.com/lukesampson/scoop. scoop installs software to your local user folder, and doesn't mess up PATH, so it doesn't require UAC. (Also I consider it faster than Chocolatey.)

spencerwooo avatar Dec 17 '18 03:12 spencerwooo

Thanks for the great app. In order to have PowerShell starting always as admin using sudo I have set the "Arguments" of the PowerShell profile to (I couldn't get environment path working and therefore hard-coded the path): -nop -noexit -Command "YOURPROFILEPATH\scoop\shims\sudo.cmd powershell"

DBremen avatar Mar 20 '19 10:03 DBremen

@ynsgnr sudo for windows works in FluentTerminal?

TylerLeonhardt avatar Mar 22 '19 22:03 TylerLeonhardt

@TylerLeonhardt It works for me

pf1gura avatar Mar 25 '19 10:03 pf1gura

Thanks for the great app. In order to have PowerShell starting always as admin using sudo I have set the "Arguments" of the PowerShell profile to (I couldn't get environment path working and therefore hard-coded the path): -nop -noexit -Command "YOURPROFILEPATH\scoop\shims\sudo.cmd powershell"

Nice trick but it makes the Admin PS session run inside the current session, so basically you have to type "exit" twice to completely close the shell. I figured out another way to achieve this: Create a new terminal profile and set the path to your sudo.cmd as the executable and use "powershell" as the argument. Set this profile as default or set a keybinding and you have a "real" Admin PS session.

kdien avatar Jun 10 '19 15:06 kdien

Just a side-note for this workaround.

Choco's refreshenv command seems to not work if you started your shell with sudo.cmd.

You may need to restart the terminal if in need of an env reload.

Ronkiro avatar Jan 09 '20 13:01 Ronkiro

New Windows Terminal can be opened as administrator, why Fluent Terminal still have this issue?

yjlin0224 avatar Mar 27 '20 11:03 yjlin0224

Hello, there is a tutorial on the web on how to achieve this: https://stefanwick.com/2018/10/07/app-elevation-samples-part-3/ is this something that will be looked into?

RhavoX avatar Jul 11 '20 15:07 RhavoX

I tried this back then, but I didn't find a way to integrate this with WinPty. I'm tending towards embedding https://github.com/gerardog/gsudo or doing something similar.

felixse avatar Jul 13 '20 19:07 felixse

I was ready to make this beauty my go-to software, but a terminal without admin rights isn't a proper terminal. Rather disappointing but looking forward for a future release that provides this essential capability.

xv avatar Aug 01 '20 07:08 xv

As a workaround, I use scoop to install sudo for windows

hanskokx avatar Aug 01 '20 10:08 hanskokx

was looking for a new terminal to switch to from conemu (too many super tiny but irritating drawbacks/bugs in that) and fluent was great, but inability to run as admin is a huge deal breaker.

one additional major reason, and not just chocolatey, is WSL2 + VSCode launch in the filesystem.

it works fine in the native PS, but if i drop into wsl2 and try to launch code in current dir from wsl2 it spits out an access denied error:

/mnt/c/Program Files/Microsoft VS Code/Code.exe: Permission denied

sounds like a similar admin level issue, but maybe not. in either case, there's definitely something with permissions that's happening within this app.

some details: windows build: 2004 wsl2 distro: ubuntu 20.04

hollowimage avatar Oct 01 '20 02:10 hollowimage

Somehow I seem too stupid to get it working. %USERPROFILE%\scoop\shims\sudo.cmd cmd.exe as well as the same with the powershell insta closes the instance right after. I'm doing something wrong but am too stupid to figure out what.

Githubber616 avatar Feb 21 '21 18:02 Githubber616

Somehow I seem too stupid to get it working. %USERPROFILE%\scoop\shims\sudo.cmd cmd.exe as well as the same with the powershell insta closes the instance right after. I'm doing something wrong but am too stupid to figure out what.

Rather than starting your shell with sudo, you need to invoke sudo per command.

hanskokx avatar Feb 23 '21 14:02 hanskokx

Somehow I seem too stupid to get it working. %USERPROFILE%\scoop\shims\sudo.cmd cmd.exe as well as the same with the powershell insta closes the instance right after. I'm doing something wrong but am too stupid to figure out what.

Rather than starting your shell with sudo, you need to invoke sudo per command.

How?

Githubber616 avatar Feb 23 '21 14:02 Githubber616

How?

image

hanskokx avatar Feb 23 '21 14:02 hanskokx

Thanks for the great app. In order to have PowerShell starting always as admin using sudo I have set the "Arguments" of the PowerShell profile to (I couldn't get environment path working and therefore hard-coded the path): -nop -noexit -Command "YOURPROFILEPATH\scoop\shims\sudo.cmd powershell"

How do I that exactly?

Githubber616 avatar Feb 24 '21 16:02 Githubber616