Sudo for Windows (2024)

(github.com)

63 points | by luispa 6 hours ago

17 comments

  • petterroea 1 hour ago
    sudo makes sense as a name, but it is worth noting that it hurts the original projects.

    Famously, the curl project receives tonnes of issues and support requests from people who run `curl` in PowerShell, not knowing it is an alias meant for convenience instead of the actual curl command[1].

    Sudo for windows is already relatively old and doesn't seem to have been adopted much, but my prediction is that adoption would mean people would complain on forums that commands they found on the internet don't work. "Why wouldnt it? I have sudo?". Then people will have to explain to them that "No you do not have sudo, you have the windows version of sudo, which is not real sudo" and it will confuse.

    When it comes to tools, I strongly believe naming things similarly to concepts the user already knows is a disservice to the user. This isn't UX for your mom and pop, it is a tool to perform a job, and learners get confused when suddenly the same thing isn't actually the same thing at all. It is mislearning, and I would argue almost anyone who does mentoring has seen this in action.

    [1]: https://daniel.haxx.se/blog/2016/08/19/removing-the-powershe...

    • boomlinde 1 hour ago
      Hopefully these aliases will be renamed to "Copilot-Sudo" and "Copilot-Curl" soon enough.
      • eddythompson80 13 minutes ago
        Uh clearly you don't PowerShell enough. It should be `Invoke-CopilotSudo`
      • dainank 48 minutes ago
        Maybe `wudo`? Windows Sudo!
        • al_borland 3 minutes ago
          If sudo stands for “superuser do”, and on Windows they call this user an “Administrator”. It stands to reason they should call it `audo`.

          Though this would be confusing, as people would pronounce it like “adieu”, which would make it sound like an alias for `logoff`.

        • miroljub 33 minutes ago
          Or 'mudo', Microsoft sudo.

          With the added benefit of having appropriate meaning in some slavic languages.

    • steve1977 1 hour ago
      > sudo makes sense as a name

      It doesn't though. There is no concept of a singular superuser like there is on UNIX. On Windows you have Administrator, but that is a role that can be assigned to any user.

      And Administrators do not have full power, that would be the SYSTEM user. Which you cannot switch to with Sudo for Windows however - but you can with the runas tool, which has been around for decades.

      • vbezhenar 1 hour ago
        Minor nitpick, but there's not necessarily a single super user in UNIX. You can create multiple users with uid=0 and they all will be super users.
        • steve1977 34 minutes ago
          See sibling reply. The uid is what defines the user, the name is just a convenient alias.
        • ButlerianJihad 59 minutes ago
          But they all have the same UID, and are technically "the same user", even if you foolishly confer disparate usernames and passwords on them. When the system reverse-maps their UID it will display "root" because there is, ultimately, only one superuser on Unix.

          The situation is the same for any userid and any groupid. If you try creating three ordinary users with a UID of 3005, they will be, essentially, the same user. There is no way at the system level to differentiate them, after they have authenticated. Because their files and processes are owned by the same UID.

          This sharing of UIDs is generally discouraged and quite undesirable. It makes systems administration a real mess.

    • pletnes 18 minutes ago
      The curl alias in powershell is not compatible so it is an inconvenience. Must be one of the worst decisions to make it into windows, which is saying a lot.
      • al_borland 0 minutes ago
        Most of the aliases are for convenience when working in an interactive shell, which will generally be dealing with more basic functions of a command. For scripting it is best practice to use the full commandlet names.
    • Pay08 1 hour ago
      > Famously, the curl project receives tonnes of issues and support requests from people who run `curl` in PowerShell, not knowing it is an alias meant for convenience instead of the actual curl command[1].

      Well, that explains a lot of the issues I was running into a few weeks ago...

    • petterroea 1 hour ago
      I, for one, have had to explain to Juniors multiple times that WSL isn't Linux, and why it's no replacement for Linux. Happens almost every time they try to do anything more advanced than a WSL hello world, and it inevitably fails.

      I still let them try, because it beats me having to check "is wsl good now", and they learn much better from personal experience than someone more senior who uses arch btw just telling them "don't use windows"

      • StableAlkyne 1 hour ago
        Interesting, I've been using it with zero issues (including performance) for several years now. Compiled stuff, ran scientific calculations, trained neural nets with GPU passthrough, even switched over a workload from an old Red hat box to WSL Alma.

        Only weirdness has been systemd can sometimes be quirky, and GUI stuff can be glitchy (which doesn't affect me much, because 99% of what I do is in the terminal)

        So, anecdotally it is perfectly adequate for workloads beyond a Hello World. What issues are you running into?

        • petterroea 1 hour ago
          Mostly its related to filesystem and permissions. Interface between windows and Linux, and mismatch in how the two work.

          Compute etc is fine!

          • yread 1 hour ago
            Yeah its best to avoid using the windows filesystem for anything else but a source of cp -r
      • bezier-curve 51 minutes ago
        WSL1 is not Linux because it is mapping system calls from the Linux kernel ABI to NT. That sounds like what you're describing. WSL2 is a Microsoft distro running in a VM that integrates into Windows.

        I use WSL2 every day and it has some annoying quirks with how their Wayland implementation behaves with DWM, but otherwise it's just a Linux environment.

      • DeathArrow 58 minutes ago
        Actually, WSL is pretty good for development. Of course, I wouldn't use WSL to run server software.
    • justsomehnguy 1 hour ago
      >> Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.[0]

      Between that quote and "You can't fix stupid" I always choose the one about circus.

      *nix fanboys were totes fine with wget and ls being an aliases in PowerShell for years but when they found out what PS is coming to Linux they made a biggest stink. It didn't even mattered what 99.999% of the scripts which utilized that call were the simple 'get file' and nothing more.

      [0] https://en.wikiquote.org/wiki/Rick_Cook#The_Wizardry_Compile...

      • jborean93 32 minutes ago
        > *nix fanboys were totes fine with wget and ls being an aliases in PowerShell for years but when they found out what PS is coming to Linux they made a biggest stink

        The curl and wget aliases don’t exist on the PowerShell 7 version which is the cross platform one. Only the old powershell.exe builtin to Windows has these aliases and it’s worse today because curl.exe is builtin and the curl alias takes priority when you run just curl.

  • RajT88 2 hours ago
    Do you want to allow the following program from an unknown publisher to make changes to this computer?

    Program Name: Sudo.exe

    Publisher: Unknown

    File Origin: Downloaded from the Internet

  • overflowy 4 hours ago
    We had https://github.com/gerardog/gsudo long before this came out.
    • tokyobreakfast 2 hours ago
      The hallmark of every successful Rust project: existence of a popular, equivalent software package not written in Rust.
    • manwe150 3 hours ago
      That fact appears to be mentioned in the docs for this sudo, as well as mentioning gsudo has more features
  • twelvedogs 29 minutes ago
    Unless this is improved greatly from the last time I used it is pointless, any command you would use it for instead requires you to right click, open as administrator a command prompt to get the expected result
  • gnabgib 6 hours ago
    (2024) At the time (587 points, 423 comments) https://news.ycombinator.com/item?id=39305452
  • userbinator 2 hours ago
    I'm surprised they didn't call it Run-AsAdministrator or some other awkward Microsoft-ism.
  • onemoresoop 1 hour ago
    Lipstick on a pig, Windows is turning into a botched version of linux.
  • G_o_D 2 hours ago
    https://m.majorgeeks.com/files/details/nsudo.html Been using it to run my cleanup or uninstaller utilities as SYSTEM/TRUSTED INSTALLER, so stubborn in use files that are not easily deletable not even with lockhunter or unlock file utilities that ultimately fallback to delete on next reboot.

    With nsudo its fizz

  • 9dev 1 hour ago
    Funny that this pops up when Linux at the same time is moving on to something better than sudo.
    • eddythompson80 5 minutes ago
      Are you referring to sudo-rs or something different? because sudo-rs is just a reimplementation of sudo.
  • archargelod 2 hours ago
    > Everything about permissions and the command line experience is different between Windows and Linux. ... certain elements of the traditional sudo experience are not present in Sudo for Windows, and vice versa. Scripts and documentation that are written for sudo may not be able to be used directly with Sudo for Windows without some modification.

    Then why is it named `sudo`? Just to create confusion?

    Also, something like sudo is clearly not possible on modern Windows, because Microsoft thinks it owns your computer and won't allow Admins to do certain things.

    • LiamPowell 2 hours ago
      It's wget for Windows all over again, just like with wget there's absolutely zero arguments shared between the two that do the same thing.
      • jasonjayr 2 hours ago
        Ah yes, the 'curl' alias in powershell, vs the 'curl.exe' binary that uses the traditional options. Always have to remember that trap on windows.
  • paweladamczuk 2 hours ago
    The embracing continues
    • saintfire 2 hours ago
      Not really. It's not the same program at all. They just took the name for an inexplicable reason. They even had to make a paragraph disclaimer stating it isn't and never will be the same program.
  • DeathArrow 55 minutes ago
    What's wrong with good old runas command?
    • jborean93 34 minutes ago
      The runas command doesn’t elevate just runs as another user. This is a console executable that drives UAC and also provides a way to capture the stdout/stderr elevated process which isn’t natively possible today without your own wrapper.
  • ButlerianJihad 25 minutes ago
  • SugarReflex 2 hours ago
    sudon't