Give administrator privileges to tab #17343

Closed
opened 2026-01-31 05:39:47 +00:00 by claunia · 6 comments
Owner

Originally created by @Fischchen on GitHub (Apr 26, 2022).

Description of the new feature/enhancement

A possibility to change certain tabs to administrator rights.
Useful when you have to deal with package managers and similar.

Proposed technical implementation details (optional)

An entry for that functionality in the CTL+SHIFT+P menu, which changes the current tab to administrator, or if that's not possible, creates a new one with administrator privileges.

Originally created by @Fischchen on GitHub (Apr 26, 2022). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> A possibility to change certain tabs to administrator rights. Useful when you have to deal with package managers and similar. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. --> An entry for that functionality in the CTL+SHIFT+P menu, which changes the current tab to administrator, or if that's not possible, creates a new one with administrator privileges.
claunia added the Area-SettingsIssue-TaskResolution-ExternalProduct-Terminal labels 2026-01-31 05:39:48 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Apr 27, 2022):

This is something you can kinda already do today, but maybe not that conveniently. As of 1.13, you can mark a profile as requiring elevation (admin rights), with elevate:true. You can also use that in a newTab action to open that profile elevated. So you could add something like:

        { "icon": "\uEA18", "command": { "action": "newTab", "elevate": true, "profile": "foo" } },

to open your foo profile as admin. Or just Ctrl+Click on the entry in the dropdown.

However, what you really want is "duplicate the current tab, with admin permission", and that's not tracked right now, I don't think. #10232 is sorta like it, but not exactly what I'm looking for. splitPane has splitMode: duplicate, maybe we need a flag like that for newTab (or just let duplicateTab accept the rest of a NewTerminalArgs

@zadjii-msft commented on GitHub (Apr 27, 2022): This is something you can kinda already do today, but maybe not _that_ conveniently. As of 1.13, you can mark a profile as requiring elevation (admin rights), with `elevate:true`. You can also use that in a newTab action to open that profile elevated. So you could add something like: ``` { "icon": "\uEA18", "command": { "action": "newTab", "elevate": true, "profile": "foo" } }, ``` to open your foo profile as admin. Or just Ctrl+Click on the entry in the dropdown. However, what you really want is "duplicate the current tab, with admin permission", and that's not tracked right now, I don't think. #10232 is sorta like it, but not exactly what I'm looking for. `splitPane` has `splitMode: duplicate`, maybe we need a flag like that for `newTab` (or just let `duplicateTab` accept the rest of a `NewTerminalArgs`
Author
Owner

@ohenryx2 commented on GitHub (Jun 5, 2022):

If you put elevate:true in the settings.json file for a new tab definition, then that will cause a new Windows Terminal window to launch. However, if you instead use sudo from the gsudo package, then you just get a new tab as expected.
{ "commandline": "sudo %SystemRoot%\\System32\\cmd.exe", "guid": "{0caa0dad-35ce-5f56-a8ff-afceeeaa6101}", "hidden": false, "name": "CMD Admin" },
The above will cause a new tab, with CMD elevated.

While this:
{ "commandline": "%SystemRoot%\\System32\\cmd.exe", "guid": "{0caa0dad-35ce-5f56-a8ff-afceeeaa6101}", "hidden": false, "elevate":true, "name": "CMD Admin" },
will instead launch a new Windows Terminal window, with an elevated command prompt. Not an additional tab. Neither method is wrong, just a matter of preference. I like a new tab, not a new window, but YMMV.

@ohenryx2 commented on GitHub (Jun 5, 2022): If you put elevate:true in the settings.json file for a new tab definition, then that will cause a new Windows Terminal window to launch. However, if you instead use sudo from the gsudo package, then you just get a new tab as expected. ` { "commandline": "sudo %SystemRoot%\\System32\\cmd.exe", "guid": "{0caa0dad-35ce-5f56-a8ff-afceeeaa6101}", "hidden": false, "name": "CMD Admin" }, ` The above will cause a new tab, with CMD elevated. While this: ` { "commandline": "%SystemRoot%\\System32\\cmd.exe", "guid": "{0caa0dad-35ce-5f56-a8ff-afceeeaa6101}", "hidden": false, "elevate":true, "name": "CMD Admin" }, ` will instead launch a new Windows Terminal window, with an elevated command prompt. Not an additional tab. Neither method is wrong, just a matter of preference. I like a new tab, not a new window, but YMMV.
Author
Owner

@zadjii-msft commented on GitHub (Jun 6, 2022):

obliged to add: as awesome as gsudo is, there is a fairly trivial escalation of privilege attack that's possible with it, so use with caution. I'm gonna collapse both these as off topic to keep focused on the implementation of the original ask here. Thanks ☺️

@zadjii-msft commented on GitHub (Jun 6, 2022): _obliged to add:_ as awesome as `gsudo` is, there is a fairly trivial escalation of privilege attack that's possible with it, so use with caution. I'm gonna collapse both these as off topic to keep focused on the implementation of the original ask here. Thanks ☺️
Author
Owner

@vertigo220 commented on GitHub (Jul 25, 2022):

Would it be possible to add a Terminal-specific command "sudo" so the user could type that, which would instruct Terminal to duplicate the tab as admin?

@vertigo220 commented on GitHub (Jul 25, 2022): Would it be possible to add a Terminal-specific command "sudo" so the user could type that, which would instruct Terminal to duplicate the tab as admin?
Author
Owner

@zadjii-msft commented on GitHub (Jun 4, 2024):

You know, I might just close this as /dup https://github.com/microsoft/sudo. Honestly, that's just the easiest user experience over all.

(we'll work on shipping that out-of-band from the OS: https://github.com/microsoft/sudo/issues/57)

@zadjii-msft commented on GitHub (Jun 4, 2024): You know, I might just close this as /dup https://github.com/microsoft/sudo. Honestly, that's just the easiest user experience over all. (we'll work on shipping that out-of-band from the OS: https://github.com/microsoft/sudo/issues/57)
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Jun 4, 2024):

Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Jun 4, 2024): Hi! We've identified this issue as a duplicate of one that exists on somebody else's Issue Tracker. Please make sure you subscribe to the referenced external issue for future updates. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17343