Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

354,155

Downloads of v 0.7.2:

6,014

Last Update:

09 Aug 2020

Package Maintainer(s):

Software Author(s):

  • Gerardo Grignoli

Tags:

sudo for windows run elevated user command runas powershell wsl

gsudo - a sudo for windows

This is not the latest version of gsudo - a sudo for windows available.

  • 1
  • 2
  • 3

0.7.2 | Updated: 09 Aug 2020

Downloads:

354,155

Downloads of v 0.7.2:

6,014

Maintainer(s):

Software Author(s):

  • Gerardo Grignoli

gsudo - a sudo for windows 0.7.2

This is not the latest version of gsudo - a sudo for windows available.

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

To upgrade gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

To uninstall gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade gsudo -y --source="'INTERNAL REPO URL'" --version="'0.7.2'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade gsudo -y --source="'INTERNAL REPO URL'" --version="'0.7.2'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install gsudo
  win_chocolatey:
    name: gsudo
    version: '0.7.2'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'gsudo' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '0.7.2'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller gsudo
{
    Name     = "gsudo"
    Version  = "0.7.2"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'gsudo':
  ensure   => '0.7.2',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved as a trusted package on 09 Aug 2020.

Description

gsudo allows to run commands with elevated permissions within the current console.
It is a sudo equivalent for Windows, with a similar user-experience as the original *nix sudo.

Elevated commands are shown in the caller (non-elevated) console, no switching to another console required.

http://github.com/gerardog/gsudo

Usage

gsudo [command] [arguments]
Executes the specified command, elevated, and returns.

Examples

gsudo notepad c:\Windows\System32\drivers\etc\hosts
gsudo cmd


bin\gsudo.exe
md5: 0EFAD72A6954DB668D952E6661E62A01 | sha1: FA1332908E7E3B83C7E8137F35745F765F7832CC | sha256: 98881CAD1AC833B7400493225A7BAF875CB519B9B14238D5477BBA5F1665406A | sha512: 6AF821E824927A78E118911582BD1BA2DE5EE33D5B2C0D75373E5BD0C9BC80959D19DD25E1BB9F8D11A3837ACEC523F05A461CCB1A437AA9FD388B70847C831B
bin\gsudo.exe.ignore
 
bin\sudo.exe.ignore
 
tools\chocolateybeforemodify.ps1
$ErrorActionPreference = "SilentlyContinue"

$running = Get-Process gsudo -ErrorAction SilentlyContinue

if ($running) {	
	gsudo.exe -k
	Start-Sleep -Milliseconds 500
}
tools\chocolateyinstall.ps1
function Test-IsSymLink([string]$path) {
  $file = Get-Item $path -Force -ea SilentlyContinue
  return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
}

if (Get-Process gsudo -ErrorAction SilentlyContinue) {
	gsudo.exe -k
	Start-Sleep -Milliseconds 500
	if (Get-Process gsudo -ErrorAction SilentlyContinue) {
		$ErrorActionPreference = "Stop"
		Write-Output '##### Please close gsudo before installing.             #####'
		Write-Output '##### Or run in new window with "-n" to let gsudo exit: #####'
		Write-Output '        gsudo -n cmd /k choco upgrade gsudo'
		
		throw "Unable to install/uninstall if gsudo is running"
	}
}

$bin = "$env:ChocolateyInstall\lib\gsudo\bin\"

if (Test-Path "$bin\sudo.exe")
{
  Remove-Item "$bin\sudo.exe"
}

# Remove from User Path on previous versions ( <= 0.7.1 )
$toolsPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$unScriptPath = Join-Path $toolsPath "Uninstall-ChocolateyPath.psm1"
$installPath = "$env:ChocolateyInstall\lib\gsudo\bin\"
Import-Module $unScriptPath

Uninstall-ChocolateyPath $installPath 'User' | Out-Null

# Add to System Path
Install-ChocolateyPath -PathToInstall $bin -PathType 'Machine'

cmd /c mklink "$bin\sudo.exe" "$bin\gsudo.exe"

if (Test-Path "$env:ChocolateyInstall\bin\gsudo.exe")  # Previous installers created symlinks on chocolatey\bin, we no longer need them.
{ 
  Remove-Item "$env:ChocolateyInstall\bin\gsudo.exe"
  if (Test-IsSymLink "$env:ChocolateyInstall\bin\sudo.exe")
  {
    Remove-Item "$env:ChocolateyInstall\bin\sudo.exe"
  }
}

Write-Output "Done."

tools\chocolateyuninstall.ps1
$toolsPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$unScriptPath = Join-Path $toolsPath "Uninstall-ChocolateyPath.psm1"

$installPath = "$env:ChocolateyInstall\lib\gsudo\bin\"

Import-Module $unScriptPath
Uninstall-ChocolateyPath $installPath 'Machine' | Out-Null
tools\LICENSE.txt
From: https://opensource.org/licenses/MIT

LICENSE

Copyright 2019 Gerardo Grignoli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tools\Uninstall-ChocolateyPath.psm1
function Uninstall-ChocolateyPath {
  param(
    [string] $pathToUninstall,
    [System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User
  )
  Write-Debug "Running 'Uninstall-ChocolateyPath' with pathToUninstall:`'$pathToUninstall`'";

  #get the PATH variable
  $envPath = $env:PATH
  #$envPath = [Environment]::GetEnvironmentVariable('Path', $pathType)
  if (!$envPath.ToLower().Contains($pathToUninstall.ToLower())) {
    Write-Host "PATH environment variable does not have $pathToUninstall in it."
    return
  }

  Write-Host "PATH environment variable has $pathToUninstall in it. Removing..."
  $actualPath = [Environment]::GetEnvironmentVariable('Path', $pathType)

  # escape regex metachars, match possible backslash and item separator at eol
  $pathToUninstallRegex = ($pathToUninstall -replace '([\\().])', '\$1') + '\\?(;|$)'

  # remove pathToUninstall from actualPath
  $actualPath = $actualPath -replace "$pathToUninstallRegex", ''

  if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) {
    $psArgs = "[Environment]::SetEnvironmentVariable('Path',`'$actualPath`', `'$pathType`')"
    Start-ChocolateyProcessAsAdmin "$psArgs"
  }
  else {
    [Environment]::SetEnvironmentVariable('Path', $actualPath, $pathType)
  }

  # remove from path of current powershell session
  $envPSPath = $env:PATH
  $env:Path = $envPSPath -replace "$pathToUninstallRegex", ''
}
tools\VERIFICATION.txt
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

1. The embedded files are also available as a release in GitHub.

Please go to releases page
https://github.com/gerardog/gsudo/releases

Download same version as this choco package (example for v0.4)
https://github.com/gerardog/gsudo/releases/tag/v0.4

unzip and get hashes
powershell -command Get-FileHash *

2. Get hashes from this choco package. Run:

powershell -command Get-FileHash bin\*

3. The checksums should match the following:
--- 
Version Hashes for v0.7.2 
 

Algorithm       Hash                                                                   Path                                                                                                             
---------       ----                                                                   ----                                                                                                             
SHA256          98881CAD1AC833B7400493225A7BAF875CB519B9B14238D5477BBA5F1665406A       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudo.exe                                                                
SHA256          E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudo.exe.ignore                                                         
SHA256          E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855       C:\git\gsudo\build\Chocolatey\gsudo\bin\sudo.exe.ignore                                                          



 

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
gsudo - a sudo for windows 2.4.3 14 Tuesday, February 20, 2024 Approved
gsudo - a sudo for windows 2.4.2 21477 Monday, December 18, 2023 Approved
gsudo - a sudo for windows 2.4.1-fixnoninteractive 138 Sunday, October 1, 2023 Approved
gsudo - a sudo for windows 2.4.0 33595 Sunday, August 27, 2023 Approved
gsudo - a sudo for windows 2.3.1-beta 120 Tuesday, August 22, 2023 Approved
gsudo - a sudo for windows 2.3.0 19898 Monday, July 17, 2023 Approved
gsudo - a sudo for windows 2.2.0 1113 Monday, July 17, 2023 Approved
gsudo - a sudo for windows 2.1.0 5220 Sunday, July 9, 2023 Approved
gsudo - a sudo for windows 2.0.10 16500 Sunday, June 4, 2023 Approved
gsudo - a sudo for windows 2.0.9 12141 Tuesday, May 2, 2023 Approved
gsudo - a sudo for windows 2.0.8 2008 Sunday, April 30, 2023 Approved
gsudo - a sudo for windows 2.0.7 1319 Friday, April 28, 2023 Approved
gsudo - a sudo for windows 2.0.6 16087 Friday, March 24, 2023 Approved
gsudo - a sudo for windows 2.0.4 39080 Monday, November 21, 2022 Approved
gsudo - a sudo for windows 2.0.3 1906 Friday, November 18, 2022 Approved
gsudo - a sudo for windows 2.0.2 4836 Thursday, November 10, 2022 Approved
gsudo - a sudo for windows 2.0.1 1611 Tuesday, November 8, 2022 Approved
gsudo - a sudo for windows 2.0.0 2087 Sunday, November 6, 2022 Approved
gsudo - a sudo for windows 2.0.0-preview 154 Sunday, October 23, 2022 Approved
gsudo - a sudo for windows 1.7.1 9242 Sunday, October 16, 2022 Approved
gsudo - a sudo for windows 1.7.0 7661 Wednesday, September 28, 2022 Approved
gsudo - a sudo for windows 1.6.0 4436 Wednesday, September 21, 2022 Approved
gsudo - a sudo for windows 1.5.1 5607 Friday, September 9, 2022 Approved
gsudo - a sudo for windows 1.4.1 2141 Tuesday, September 6, 2022 Approved
gsudo - a sudo for windows 1.4.0 1680 Sunday, September 4, 2022 Approved
gsudo - a sudo for windows 1.3.0 36482 Wednesday, April 13, 2022 Approved
gsudo - a sudo for windows 1.2.1-alpha11 52 Tuesday, April 12, 2022 Approved
gsudo - a sudo for windows 1.2.1-alpha10 52 Tuesday, April 12, 2022 Approved
gsudo - a sudo for windows 1.2.0 6392 Friday, March 25, 2022 Approved
gsudo - a sudo for windows 1.1.1 5002 Saturday, March 12, 2022 Approved
gsudo - a sudo for windows 1.1.0 4549 Sunday, February 27, 2022 Approved
gsudo - a sudo for windows 1.0.2 37265 Wednesday, August 18, 2021 Approved
gsudo - a sudo for windows 1.0.1 4211 Saturday, August 7, 2021 Approved
gsudo - a sudo for windows 0.7.3 14962 Sunday, December 20, 2020 Approved
gsudo - a sudo for windows 0.7.2 6014 Sunday, August 9, 2020 Approved

This package has no dependencies.

Discussion for the gsudo - a sudo for windows Package

Ground Rules:

  • This discussion is only about gsudo - a sudo for windows and the gsudo - a sudo for windows package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or gsudo - a sudo for windows, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus