Root user/sudo equivalent in Cygwin
From: https://stackoverflow.com/questions/4090301/root-user-sudo-equivalent-in-cygwin
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. Create a file ~/bin/sudo
with the following content:
#!/usr/bin/bash
cygstart --action=runas "$@"
Now make the file executable:
$ chmod +x ~/bin/sudo
Now you can run commands with real elevated privileges:
$ sudo elevatedCommand
You may need to add ~/bin
to your path. You can run the following command on the Cygwin CLI, or add it to ~/.bashrc
:
$ PATH=$HOME/bin:$PATH