# gerardog/gsudo

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/gerardog-gsudo).**

5,978 stars · 161 forks · C# · MIT

## Links

- GitHub: https://github.com/gerardog/gsudo
- Homepage: https://gerardog.github.io/gsudo
- awesome-repositories: https://awesome-repositories.com/repository/gerardog-gsudo.md

## Description

gsudo is a command-line utility for Windows that elevates any command with administrator privileges directly from the current console window. It functions as a sudo-style tool, detecting the active shell environment—whether CMD, PowerShell, WSL, or Bash—and running the elevated command natively within that shell without spawning a new window. The tool preserves full console features including colors, keyboard input, auto-completion, and I/O redirection during elevated execution.

A key differentiator is gsudo's credential caching system, which stores UAC-approved tokens in a background daemon so repeated elevation requests show only one authorization prompt until a configurable timeout expires. The tool supports multiple elevation modes, including named-pipe token switching for full console support and token duplication to avoid new UAC prompts. Users can also launch processes under specific user accounts, the system account, or TrustedInstaller with configurable integrity levels.

gsudo provides a JSON-based configuration store for persisting settings like cache mode, timeout, and log verbosity. It includes shortcut syntax for re-running the last command elevated, supports script execution with proper exit code handling, and can create elevated Windows Terminal profiles. The tool also reports elevation status and cache session activity for monitoring purposes.

## Tags

### Development Tools & Productivity

- [Cross-Shell Elevators](https://awesome-repositories.com/f/development-tools-productivity/shell-command-execution/privileged-shell-executions/cross-shell-elevators.md) — Detects the active shell environment and runs elevated commands natively within CMD, PowerShell, WSL, or Bash without spawning a new window.
- [Console-Preserving Elevations](https://awesome-repositories.com/f/development-tools-productivity/command-configuration-utilities/external-command-integrations/debugger-command-apis/debugger-console-commands/console-preserving-elevations.md) — gsudo executes a command as administrator in the current console window, preserving full console features like colors and keyboard input. ([source](https://gerardog.github.io/gsudo/docs/intro))
- [Bash Shell Elevations](https://awesome-repositories.com/f/development-tools-productivity/command-line-completions/shell-command-suppressions/bash-shell-elevations.md) — Prepends gsudo to run a command with administrator privileges from within a Bash for Windows shell. ([source](https://gerardog.github.io/gsudo/docs/usage/bash-for-windows))
- [PowerShell Wrapped Elevations](https://awesome-repositories.com/f/development-tools-productivity/shell-command-runners/command-wrapping/powershell-wrapped-elevations.md) — Wraps a command with Invoke-gsudo to pass variables, credentials, and profile context using familiar PowerShell syntax. ([source](https://gerardog.github.io/gsudo/docs/usage/powershell))
- [Token Switching via Named Pipes](https://awesome-repositories.com/f/development-tools-productivity/stream-piping-utilities/named-pipe-streaming/named-pipe-forwarding/token-switching-via-named-pipes.md) — Duplicates access tokens across named pipes to elevate processes without spawning a new window.

### System Administration & Monitoring

- [Elevation Utilities](https://awesome-repositories.com/f/system-administration-monitoring/task-automation-scripts/elevation-utilities.md) — Elevates shell commands in CMD, PowerShell, and WSL while preserving console features and I/O.
- [UAC Credential Caches](https://awesome-repositories.com/f/system-administration-monitoring/cache-management/uac-credential-caches.md) — Caches UAC-approved tokens so repeated elevation requests show only one authorization prompt until the cache expires.
- [Administrative Command Engines](https://awesome-repositories.com/f/system-administration-monitoring/command-execution-engines/administrative-command-engines.md) — Executes privileged system commands with administrator rights across multiple shell types in the current console. ([source](https://cdn.jsdelivr.net/gh/gerardog/gsudo@main/README.md))
- [Cache Duration Configurations](https://awesome-repositories.com/f/system-administration-monitoring/cache-management/uac-credential-caches/cache-duration-configurations.md) — gsudo limits how long an idle elevated session remains open before it automatically closes. ([source](https://gerardog.github.io/gsudo/docs/credentials-cache))
- [Cache Mode Configurators](https://awesome-repositories.com/f/system-administration-monitoring/cache-management/uac-credential-caches/cache-mode-configurators.md) — gsudo sets the cache mode to automatic, explicit, or disabled to control when UAC prompts appear for elevation. ([source](https://gerardog.github.io/gsudo/docs/credentials-cache))
- [Cache Session Lifecycles](https://awesome-repositories.com/f/system-administration-monitoring/cache-management/uac-credential-caches/cache-session-lifecycles.md) — gsudo starts or stops a credential cache manually and specifies which process or idle timeout governs the session. ([source](https://gerardog.github.io/gsudo/docs/credentials-cache))
- [PowerShell Command Elevations](https://awesome-repositories.com/f/system-administration-monitoring/task-automation-scripts/elevation-utilities/powershell-command-elevations.md) — Runs a command or script block in an elevated PowerShell session, preserving console output and pipeline context. ([source](https://gerardog.github.io/gsudo/docs/usage/powershell))
- [Credential Cache Session Terminations](https://awesome-repositories.com/f/system-administration-monitoring/terminal-session-managers/session-termination/credential-cache-session-terminations.md) — Provides a command to kill all cached elevated sessions, forcing fresh UAC prompts on next elevation. ([source](https://gerardog.github.io/gsudo/docs/credentials-cache))

### Data & Databases

- [Shell Elevation Sessions](https://awesome-repositories.com/f/data-databases/external-storage-integrations/volume-mounts/elevated-capability/shell-elevation-sessions.md) — Elevates the entire current shell session in the same console window, preserving working directory and environment. ([source](https://gerardog.github.io/gsudo/docs/intro))
- [Cache Behavior Configurators](https://awesome-repositories.com/f/data-databases/performance-caching-systems/page-caching-controls/http-cache-headers/cache-behavior-configurators.md) — Sets the cache to start automatically, only on explicit request, or remain disabled for all elevations. ([source](https://gerardog.github.io/gsudo/docs/credentials-cache))

### DevOps & Infrastructure

- [Credential Cache Daemons](https://awesome-repositories.com/f/devops-infrastructure/background-daemon-services/credential-cache-daemons.md) — Runs a background daemon that caches UAC tokens to suppress repeated elevation prompts.

### Operating Systems & Systems Programming

- [File and Console I/O](https://awesome-repositories.com/f/operating-systems-systems-programming/file-i-o-management/i-o-polling/file-and-console-i-o.md) — Maintains full console capabilities like colors, keyboard input, auto-completion, and I/O redirection during elevation. ([source](https://gerardog.github.io/gsudo/docs/intro))
- [Shell Environment Detection](https://awesome-repositories.com/f/operating-systems-systems-programming/shell-environment-detection.md) — Identifies the active shell environment at runtime to run elevated commands natively within that shell.
- [Named Pipe](https://awesome-repositories.com/f/operating-systems-systems-programming/i-o-redirections/named-pipe.md) — Ships a named-pipe elevation mode that redirects I/O for elevated processes at the cost of keyboard support. ([source](https://gerardog.github.io/gsudo/docs/how-it-works))
- [Configurable Integrity Levels](https://awesome-repositories.com/f/operating-systems-systems-programming/system-level-integrations/configurable-integrity-levels.md) — Provides configurable integrity levels for launching processes as System or TrustedInstaller.
- [Integrity Level Switches](https://awesome-repositories.com/f/operating-systems-systems-programming/system-level-integrations/integrity-level-switches.md) — Launches processes under specified user accounts, system accounts, or TrustedInstaller with configurable integrity levels.
- [Integrity Level Switches](https://awesome-repositories.com/f/operating-systems-systems-programming/user-session-switching/integrity-level-switches.md) — Launches processes under specified user accounts, system accounts, or TrustedInstaller with configurable integrity levels.

### Security & Cryptography

- [Multi-Shell Elevation](https://awesome-repositories.com/f/security-cryptography/multi-shell-elevation.md) — Detects the active shell and runs elevated commands natively within CMD, PowerShell, WSL, and Bash. ([source](https://gerardog.github.io/gsudo/))
- [Process Privilege Elevation](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation.md) — Elevates the entire current shell session by running gsudo without arguments, a core privilege elevation capability. ([source](https://gerardog.github.io/gsudo/docs/tips/mixed-elevation-in-windows-terminal))
- [Console-Attached Elevation](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation/console-attached-elevation.md) — Attaches elevated processes to the caller's console window, preserving full terminal features.
- [Windows Sudo Elevators](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation/windows-sudo-elevators.md) — Runs commands with administrator privileges from any Windows shell, preserving console features and caching credentials to reduce UAC prompts.
- [Authentication Token Caching](https://awesome-repositories.com/f/security-cryptography/token-authentication/authentication-token-caching.md) — Caches authentication tokens locally so repeated elevation requests show only one UAC prompt until timeout. ([source](https://gerardog.github.io/gsudo/docs/intro))
- [CMD Command Elevations](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation/cmd-command-elevations.md) — Runs a non-PowerShell command with elevated privileges using the -d flag to avoid spawning a new PowerShell instance. ([source](https://gerardog.github.io/gsudo/docs/usage/powershell))
- [Same-Console Elevations](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation/same-console-elevations.md) — Runs a program with administrator privileges while keeping the elevated process attached to the current console window for seamless interaction. ([source](https://gerardog.github.io/gsudo/docs/security))
- [Token Duplication Elevation](https://awesome-repositories.com/f/security-cryptography/process-privilege-elevation/token-duplication-elevation.md) — Duplicates security tokens from already-elevated processes to avoid new UAC prompts.
- [Process Launchers Under Specific Identities](https://awesome-repositories.com/f/security-cryptography/user-account-management/process-launchers-under-specific-identities.md) — Launches processes under specified user accounts, system account, or TrustedInstaller with configurable integrity levels. ([source](https://cdn.jsdelivr.net/gh/gerardog/gsudo@main/README.md))
- [Command Execution Under User Identity](https://awesome-repositories.com/f/security-cryptography/user-identity-management/command-execution-under-user-identity.md) — Executes commands under a different user account with appropriate permissions, matching the command execution under user identity concept. ([source](https://gerardog.github.io/gsudo/docs/intro))

### Part of an Awesome List

- [Command Line Tools](https://awesome-repositories.com/f/awesome-lists/devtools/command-line-tools.md) — Sudo equivalent for running commands with elevated permissions.
- [System Administration Tools](https://awesome-repositories.com/f/awesome-lists/devtools/system-administration-tools.md) — Elevated command execution for Windows terminals.
