Cygwin missing sudo

cygwin;sudo

I am trying to run a linux script on my Windows machine using cygwin.

I have already read and tried the solutions from There's no 'sudo' command in Cygwin, without any success.

I have a script that uses sudo in the regular linux environment. but when I run the scirpt on cygwin, it throws this error message:

project_common.sh: line 604: sudo: command not found

I know cygwin does not have sudo, and the referenced question mentioned earlier said to use:

>#!/usr/bin/bash
>"$@"

I tried executing that command before running the script. and also embedding the command into the script. Neither one help. So not sure what am I missing.

Best Answer

Remove any sudo's in the file and run the script as Administrator.

That being said, the Linux idea of root and Windows idea of Administrator do not correspond exactly. You may still have permission issues that need to be rectified manually or by modifying the script further, especially on Windows Vista/7.

By the way, the referenced question wanted you to put

>#!/usr/bin/bash
>"$@"

in a file named sudo, give it executable permission with chmod, and then put it in some directory in your $PATH, such as /sbin. The resulting file will not do anything except execute the paramaters you give it as a command. The idea was to make a "fake" sudo that does nothing. You can also just delete the sudo's from the file.

Related Question