Show HN: Sudo for Windows
github.com
github.com
Or if you know the admin account you could use something like
Invoke-Command -ScriptBlock { ls } -ComputerName $env:COMPUTERNAME -Credential (Get-Credential)Not if I want resemblance with Bash-like shells. I guess that's also the point of this: Most people already know sudo from Linux and cmd.exe, now they can use both together.
(Plus powershells structured output so you can use 'where' and 'select' and 'get-member' rather than scraping with regexs. )
It isn't that hard to build a decent shell, if zsh can do it, why can't MS put a few decent interns on it and get their act together? I feel like I'm knocking skulls together whenever I end up talking Powershell with someone from across the lake here in Seattle, this stuff isn't all that difficult!
Your comment successfully added nothing of value to this HN thread, besides showing your lack of ability to string together a coherent and logical reply, good jerb!
Your bashing of PS either comes from ignorance or you simply did not invest enough time to learn the technology. Tab completion and copy/pasting works flawlessly in powershell..you can even pipe to clip and have it in your clipboard. Downloading a damn file from internet is one of the simplest things you can do in PowerShell (and imho more pleasant than gluing wget/curl in your scripts). Bashing the syntax is totally unfair as it's a different paradigm.
I don't want to have to spend my time installing a bunch of crap on each Windows box I touch, it either has sane defaults and is usable from the get go, or I'm polishing a turd.
With that I learned to live with somewhat crappy terminal. Other than that I do not see anything that I would need.
Sorry but this just sounds like you don't know PS well enough. Run it under ConEmu, install PSReadline, PsFzf and a bunch of other goodies and those problems are gone. I'm not saying it's obvious, but there's enough tutorials out there for getting you up and running.
opening Internet Exploder when I just wanna download a damn file via CLI!
Again, seems like you are doing it wrong:
> wget news.ycombinator.com
StatusCode : 200
StatusDescription : OK
Content : <html op="news"><head><meta name="referrer"
...>wget news.ycombinator.com --2017-06-15 03:04:37-- http://news.ycombinator.com/ Resolving news.ycombinator.com (news.ycombinator.com)... 104.20.44.44, 104.20.43.44
I'm not gonna install a million plugins to fix Powershell, what incentive do I have? At this point Windows is a rapidly dying platform in Point of Sale, with SLES having fully replaced it in nearly every major US grocer.
Nearly every interaction I have had with Powershell in the past 3 years has left me sad, angry, and frustrated. Building a decent shell isn't a monumental task, and I don't get why the occasional Windows box I touch is always a mess wrt Powershell.
You don't have to install plugins, tab completion etc works out of the box, copy/paste as well but in a not too handy way, I was just suggesting how to make it better. Then again, I have yet to meet a shell and OS which has all tools I want out of the box so for me the 'I down't want to install stuff' point is moot. Though if it's not for you, that's fine but you might get stuck at times.
Nearly every interaction I have had with Powershell in the past 3 years has left me sad, angry, and frustrated.
That is certainly possible, but isn't that just the result of not knowing it well enough? I mean, I've felt the same when first learning bash years ago. I quickly figured it mostly wasn't because of bash, but rather my lack of knowledge and/or trying to do things my (conceived 'proper') way instead of the bash way.
Emblematic of what's wrong with the Powershell (or perhaps MS as a whole) philosophy: you don't build this functionality into a shell, you build a file system module (you'd do it with FUSE if on Linux) that "mounts" the registry as a bunch of files. Then you could edit it in any shell or text editor, or even in a GUI file manager and GUI text editor if you wanted to.
I can see a lot more maintainability and portability of a implementation using FUSE to mount these systems as filesystems (so the abstraction is complete across the entire system instead of just in the command). Also the ease of having a abstraction which does not require special capabilities to be added to a program before it is useful is a reason that no system has properly supported these models before in this manner. On a UNIX system the same techniques could of been implemented sometime between the 70's and now to interact with environment variables and it has probably been implemented before but it has not gained mindshare as that approach is not scalable.
make && ./output
works. Git works from it. Also with clink (https://mridgers.github.io/clink/ ) it becomes even more similar. But you're right: For the times where you need more, you should fire up MSYS2 for example.I can't count how often I relaunch Command Prompt to Run as Admin.
But I'm hesitant to use a third party tool here, I really wish Microsoft just dealt with this properly.
2 - Select Run As...
1. Launch Notepad.
2. Open etc\hosts (within the bowels of C:\Windows).
3. Edit the file.
4. Try to save.
5. Profit?!? No, fail!
And if we go by "standard across all * nix variants", outside of base POSIX (if even that), nothing is really standard across all * nix variants. There's no way "standards across all * nix variants" can compete with Microsoft's APIs available across, say, 90% of their installed user base.
Developers that are fine with xmonad and CLI, settle for a POSIX experience, making such APIs like PolicyKit barely used, because portable UNIX applications don't adopt them.
Also, not sure why you've received two replies, that are - as far as I can see, completely irrelevant to what you've written; it's bizarre.
I'm author. I added this because I want to write hosts file with ":w !sudo tee %" from gvim.exe on Windows. But most of implementations doesn't work for this.
It's annoying that you still have to navigate the UAC dialog though - not sure how to get around that, without compromising security.
For those talking about right-click on the EXE... If you live in the command prompt, having to reach for the mouse just to elevate is irritating as hell.
Does your "something identical in 10 lines" do that?
I disagree, that's just an additional feature of it. The main point is that you can carry out admin tasks from an otherwise more restricted environment, so you only elevate your power when necessary. Otherwise, users might be tempted to always run whole sessions as an admin/root for convenience.
0: https://www.reddit.com/r/netsec/comments/6e1uft/a_poc_demons...
`Start-Process <stuff> -verb RunAs` does the same
For those without much Windows GUI-fu, shift-right click.
--
[1] Yes, I know this is awful security, but sometimes you have no choice.
Wait, then where does the whole UAC thing comes from??
RunAs always asks for password for the Administrator account (not the account for the delegated account like sudo). I have admin access to my work PC, but not the Administrator password (since UAC grants me access). Also, running elevated programs always in separate windows, so you can't redirect their input/output. And CLI program disappear instantly (no time to read the output).
I have used elevate.exe (http://code.kliu.org/misc/elevate/) but sudo seems even better (supports redirecting input/output).
I am not sure if I understand this. Does the machine have two different admin accounts, once of which you have access to?
runas /user:Administrator2Sounds dangerous to me.
Specially dimmed background, characteristic sound, the dialog runs on a dedicated desktop i.e. you won’t see any apps nor the start menu. Also the default button is No i.e. you can’t accidentally press Yes with enter or space keys, you have to use a mouse.
This solves a real problem and it works great. There's no horrible issue with getting a UAC dialog every time you do a sudo command. After all, in Windows (for better or worse) you need to be Administrator for less stuff.
cygstart --action=runas
This works well, too.alias sudo="cygstart --action=runas"
(and it would spare two key strokes ;)