Git Product home page Git Product logo

Comments (13)

guillermooo avatar guillermooo commented on July 16, 2024

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.

guillermooo avatar guillermooo commented on July 16, 2024

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.

lukesampson avatar lukesampson commented on July 16, 2024

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.

guillermooo avatar guillermooo commented on July 16, 2024

Yes, that is correct.

from psutils.

lukesampson avatar lukesampson commented on July 16, 2024

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.

lukesampson avatar lukesampson commented on July 16, 2024

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.

guillermooo avatar guillermooo commented on July 16, 2024

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.

lukesampson avatar lukesampson commented on July 16, 2024

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.

lukesampson avatar lukesampson commented on July 16, 2024

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.

guillermooo avatar guillermooo commented on July 16, 2024

Everything seems to be working fine. Thanks!

from psutils.

guillermooo avatar guillermooo commented on July 16, 2024

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.

lukesampson avatar lukesampson commented on July 16, 2024

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.

guillermooo avatar guillermooo commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.