There's no 'sudo' command in Cygwin

One way is to create a fake "sudo" command with the following content:

#!/usr/bin/bash

"$@"

This will allow the install.sh to continue, because sudo is found.

This doesn't elevate privileges like real sudo does. If you really need elevated privileges start cygwin shell with from an account with administrative privileges (XP) or r-click on cygwin.bat and "run as administrator" (Vista,Win7)


I found the answer on the cygwin mailing list. To run command with elevated privileges in Cygwin, precede the command with cygstart --action=runas like this:

$ cygstart --action=runas command

This will open a Windows dialogue box asking for the Admin password and run the command if the proper password is entered.

This is easily scripted, so long as ~/bin is in your path:

$ cat ~/bin/sudo
#!/usr/bin/bash
cygstart --action=runas "$@"

$ PATH=$HOME/bin:$PATH
$ chmod +x ~/bin/sudo
$ sudo elevatedCommand

Tested on 64-bit Windows 8.


I wrote the (rather simple) TOUACExt for SUDO for CygWin, a pre-beta shell script automation that approaches to the behavior of classical sudo for Linux:

  • Open and closes automatically sudoserver.py when needed.
  • Requests UAC Elevation Prompt.

Installation requires copying the four .sh scripts to some path directory, creating an alias and just a few more steps detailed in the thread.

The results: you type a single sudo YourCommand and you get the output of it, without having to worry about the rest of the process.