Re: equivalent to su or sudo?
- Date: Fri, 17 Aug 2018 23:49:54 -0400
- From: cyg Simple <cygsimple@xxxxxxxxx>
- Subject: Re: equivalent to su or sudo?
On 8/17/2018 4:33 PM, David Rothenberger wrote:
> Ulli Horlacher wrote:
>> I need to run some scripts with full administrator rights (for chown,
>> chmod, setfacl).
>> Is there a cygwin equivalent to su or sudo?
> I use the following shell script to start a command as Administrator. I mainly just use it to start mintty.
> cmd="$(cygpath -da "$1")"; shift
> if [ $# -gt 0 ]; then
> powershell Start-Process "$cmd" -ArgumentList \""$@"\" -Verb RunAs -WindowStyle Hidden
> powershell Start-Process "$cmd" -Verb RunAs -WindowStyle Hidden
You don't need powershell for that.
export PS1="% "
cygstart --action=runas mintty --title=Admin -e /bin/bash -il
The export of PS1 is to mark that the terminal window is in
administrative rights. You can modify the shell program to dash, ash
zsh or whatever you favorite shell is. Make sure to issue the
interactive and login support for the shell.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple