delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/08/17/23:50:14

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=L1Z9iz/23C5DKf/g
Ezb701RKk68TZUuMCEjer0O8MigGRm9isE/RoO91qHUHHAxDUZ9RV2WqLXR6xXWj
Z5dM0/DEXHZaE3jSxGY04gx9FQ4u1Ek8yq/uK3upM58P8qtyprrwmGbgrdSgW+w4
j9frauXmxT5o6ToQ0Jm3ceClRjE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=dP0sTRat+b7biA8lm0PuET
T5S1o=; b=utgW14F/YXGpPtfCBA/WmTb76Wv/yv3chz7rJYaZKAQSCPojniTu10
oemos4tD5+dmqZ8dVdlGP95E+jUOLpqpJPI+BVo8uNMFrdT79wt5aqeRQariWI4U
f0p4yLavcxi38SOMF0pGwnGum9yVqoQ4SeRSixoD5GsY9LOBEOxho=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=favorite, Administrator, Rothenberger, rothenberger
X-HELO: mail-io0-f170.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Bpudt6MQZcZcYhgdq5ZjY4vIyhniOoCDPwFgEaA66BM=; b=WgzXCYFvQ46+Vm9Chdgyv6KM8zsnVUzcFypMzgdYjpJEdAKLRRzUj7KopyYWk8UVLV CT0FYRD8kbgcSjvM6kWf5RVRbZgA9xDqzdnXKCahQKrBSzIRCEtuyHTwCcjKdH9K2D8F LStK8Hk2+tM3/GN9NlWL/lIscG2VyUkM1JvMSz2WkhJwGOf9F1Wja5DDQkhbwXvm5BlP huORCPd/gr6aIhZFze5+2Ncm4v2dQLGdgP7MjYBLjeftfv+Cgu+XRIZ4zw7y+66nuQ+y D7s8w5dRaVLfJNgsSc3NToHpn9oAkCKkGunW2f9N4ZW+bXp+VsWkIzi/MKv/qvf/MiS1 UX4Q==
Subject: Re: equivalent to su or sudo?
To: cygwin AT cygwin DOT com
References: <20180817100101 DOT GB24845 AT rus DOT uni-stuttgart DOT de> <94a4da29-e383-11ec-f2cc-ced6afaf1ae2 AT acm DOT org>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <342f87ef-889d-311b-5181-ade5a9fafcc1@gmail.com>
Date: Fri, 17 Aug 2018 23:49:54 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <94a4da29-e383-11ec-f2cc-ced6afaf1ae2@acm.org>
X-IsSubscribed: yes


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019