From: cyg Simple <cygsimple@gmail.com>
To: cygwin@cygwin.com
Subject: Re: equivalent to su or sudo?
Date: Sat, 18 Aug 2018 14:28:00 -0000 [thread overview]
Message-ID: <342f87ef-889d-311b-5181-ade5a9fafcc1@gmail.com> (raw)
In-Reply-To: <94a4da29-e383-11ec-f2cc-ced6afaf1ae2@acm.org>
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.
>
> #!/bin/bash
> cmd="$(cygpath -da "$1")"; shift
> if [ $# -gt 0 ]; then
> powershell Start-Process "$cmd" -ArgumentList \""$@"\" -Verb RunAs -WindowStyle Hidden
> else
> powershell Start-Process "$cmd" -Verb RunAs -WindowStyle Hidden
> fi
>
You don't need powershell for that.
<file name="/usr/local/bin/runas">
#!/bin/sh
export PS1="% "
cygstart --action=runas mintty --title=Admin -e /bin/bash -il
</file>
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.
--
cyg Simple
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2018-08-18 3:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-17 13:08 Ulli Horlacher
2018-08-17 13:36 ` john doe
2018-08-17 14:36 ` Ulli Horlacher
2018-08-17 17:15 ` Andrey Repin
2018-08-17 18:55 ` Achim Gratz
2018-08-18 3:50 ` David Rothenberger
2018-08-18 14:28 ` cyg Simple [this message]
2018-09-30 14:40 ` Erik Soderquist
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=342f87ef-889d-311b-5181-ade5a9fafcc1@gmail.com \
--to=cygsimple@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).