How can I run a Cygwin command (not a Windows native command) as privileged?

1

If I open a (elevated via UAC) Bash Shell in CygWin:

Luis@Kenobi /cygdrive/c/Windows/system32
$ crontab.exe -l -u Luisito
must be privileged to use -u

Tested on WinXP-SP3 and Win7-SP1. Same results on remote (SSH) console. Both accounts (Luis and Luisito) belong to Administrators.

How can I use, for example, crontab to list another user's crontab list?

Additional Points:

  • Tested with user SYSTEM:

I have this file named MyShell.cmd:

c:\CygWin\bin\bash.exe --login -i

So I call it from (elevated by UAC, of course) PSExec to get System rights:

psexec -i -s d:\MyShell.cmd

and I get a new shell to try, but the problem keeps:

SYSTEM@Kenobi /cygdrive/c/Windows/system32
$ whoami.exe
SYSTEM

SYSTEM@Kenobi /cygdrive/c/Windows/system32
$ crontab.exe -l -u Luisito
must be privileged to use -u

Sopalajo de Arrierez

Posted 2014-03-08T16:02:48.243

Reputation: 5 328

Answers

1

If the situation has not changed (and things like these don't seem to have, really) then according to this post:

The -u option only works for SYSTEM so far and as such is somewhat useless on Cygwin currently.

Seems the only way to get -u working is to run the shell under the SYSTEM user, a "normal" elevated Administrators shell does not suffice.

Adrian Frühwirth

Posted 2014-03-08T16:02:48.243

Reputation: 771

No, it doesn't work either, @Adrian Frühwirth. I have edited the original question to show the results using PSExec to get System privileges. – Sopalajo de Arrierez – 2014-03-12T01:32:57.530