Comments (13)
If you run this, do you get a UAC popup?
start powershell.exe -arg "-nologo -noexit echo 'hi from admin'" -verb runas
I do... I'll try to look into the issue.
from psutils.
This seems to be the problem:
https://github.com/lukesampson/psutils/blob/master/sudo.ps1#L72
If the user is not an admin, the !is_admin
will always abort execution, without giving a chance to reach the elevation part. Perhaps I'm missing something, but I've tried both from my regular and admin accounts, and by removing that check, everything seems to work as expected.
from psutils.
Oh right—thanks for looking into it.
I intended sudo to work from an account that's in the local Administrators group, or the local Administrator account. Looks like I didn't handle the latter case though.
Am I right to understand that your regular account is not in the local Administrators group, and your admin account is the actual built-in Administrator account?
from psutils.
Yes, that is correct.
from psutils.
Hmmm. If you're the Administrator then I would expect is_elevated on line 66 to return true and it should run your command. The only thing I can guess is that maybe it's something to do with being a domain admin, but not a local admin?
Would you mind running this gist in powershell and sending me the output so I can try to reproduce the problem? You can run it quickly with
iex (new-object net.webclient).downloadstring('https://gist.github.com/lukesampson/6725722/raw/sudo_diag.ps1')
If you prefer not to put details here, my email is "me at lukesampson dot com".
from psutils.
I've updated sudo with is_admin and is_elevated removed, so this should work for you now—you'd just need to run
scoop update
scoop update sudo
from psutils.
Everything seems to work fine now. Thanks!
For completeness, on my Win7 machine my admin account is not the default Administrator account. I had originally had trouble using scoop on my Win8 machine, though, but I suspect it's the same thing there.
from psutils.
Great, glad it works now! Thanks for taking the time to look into it. Let me know if you find any more problems, but I'll close this one now.
from psutils.
Based on your insight in #4, sudo
now checks whether the current user is in the Administrators group in a non-English-centric way, and only allows elevation if they are.
This should prevent problems caused by elevating to a different account with a different path variable. I've removed the warning against doing this when you install through scoop, since it's no longer possible.
If you get a chance to confirm whether this works on your multicultural setup, I'd appreciate it! I.e.
scoop update; scoop update sudo
I did try installing another language pack, but apparently you need the Ultimate or Enterprise editions to do that :(
from psutils.
Everything seems to be working fine. Thanks!
from psutils.
I've realized the environment problem remains. I cannot run ln
elevating to an account other than mine, because scoop
and friends aren't available there. So it seems keeping the notes would still make sense?
from psutils.
So is sudo
allowing you to elevate to an account other than yours? I'm not sure how that can happen, my assumption is that anyone in the Administrators group who runs sudo
will elevate under their own account with the same environment. And sudo
is supposed to ensure you're in Administrators before it runs.
Or are you elevating using 'Run as administrator'?
from psutils.
Yes, I didn't apply any special configuration, but I have two admin accounts and I can choose which one to use when elevating. I simply use sudo
.
from psutils.
Related Issues (20)
- shasum.cmd cannot process file that have parenthesis in its file name HOT 6
- shasum: no output when using --check option
- `sudo` does not work in PowerShell 6 HOT 11
- touch fails when running in strict mode HOT 1
- Boolean values are converted to strings
- 'sudo' ignores profile scripts? HOT 4
- gitignore util does not seem to work when piping console output to a file
- time command eroor
- sudo caught by AV HOT 1
- sudo history
- Sudo fails running in PowerShell ISE HOT 2
- sudo error ---- Using Windows Terminal. Don't show up the UAC dialog
- Access denied when using powershell command `Out-File` with `sudo` HOT 3
- Having troubles with Get-VM using sudo HOT 1
- Doesn't work when the username has space in it HOT 1
- [sudo] Command is incorrectly parsed when calling a .NET function
- Piping stuff to sudo
- timecmd InvalidOperation at tme.ps1:7
- redshift-tray include Trojan:Win32/Ymacco.AA46
- sudo breaks the shell after terminating a batch job with ctrl+c
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psutils.