Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: line 604: sudo: command not found

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


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.

share|improve this question

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


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.

share|improve this answer
Thats not really the right answer. It is almost like saying, there is no copy command in Microsoft Office, Let rewrite MS Office. – Churk Jun 4 '12 at 14:08
No, it's like saying given operating system A and B, and capability C which works one way under A and a different way under B, that your script which can be run under A and B might need to be rewritten to account for the differences in implementation of C. – LawrenceC Jun 4 '12 at 14:14
sudo isn't in cygwin because you essentially are the superuser of the shell when you "Run [cygwin] as Administrator". In other words, your problem is not with cygwin, it's with your file permissions in Windows. – kevlar1818 Jun 4 '12 at 14:45

Try this:

#!/usr/bin/env bash

cygstart --action=runas "$@"

It works similar to sudo, the disadvantage is, that you need to confirm the UAC dialog manually. This script is part of my dot repo.

share|improve this answer

There are other answers on Stackoverflow and Superuser which shows how to execute a command with elevated priviliges from a Cygwin prompt. I'm using an alias:

alias sudo="cygstart --action=runas"

Works as a charm for external programs (not shell built-ins, though):

sudo chown User:Group <file>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.