delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/05/20/22:20:13

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:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; q=dns; s=default; b=sGZKHaDpr0XdhgBsElp5
4HUuHYca1LvGmv0L5kjiI2JxlTQtmzwPqjOfk5ZDWoVsuL3ecfPIuzp/oc5O+Clp
bH4xXhE06Xj0MUGMH8E7Peob9aoJgVTRvGRDhpiuK3+1ReQ0G2VMp84N2xAi3bWj
3y+zBxDeJAR7LmK6HN2cdoA=
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:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; s=default; bh=miZmNdwv553gjFSSQa6EZusWpe
s=; b=BQFTnj9VhZ5MnvtSi+nHQAaqL00bpOU+bCG8JVXPtUOMD4gLDYY1k6ZzGF
o4ssgpA5o3T22HlhByfDz9/2SDZqDMPJiluboMdZdPbDeKUOCUe8iWY9mxbikvm8
T1Mp5mYcyZYiWjHf1UFPRIBwol5lFZuNfV2xjRd8TK1Gii738=
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.2 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.1 spammy=H*u:1.3.7, H*UA:1.3.7, Easy, Adilovic
X-HELO: www16.qth.com
MIME-Version: 1.0
Date: Mon, 20 May 2019 22:19:59 -0400
From: Chris Wagner <wagnerc AT plebeian DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
In-Reply-To: <CAJoYywWVTtoq1dN9hy5oxvdYzFN0qk70s-UNX198rZYiULreVA@mail.gmail.com>
References: <CAJoYywWVTtoq1dN9hy5oxvdYzFN0qk70s-UNX198rZYiULreVA AT mail DOT gmail DOT com>
Message-ID: <55eb0fac0febf91e25b30f906b552403@plebeian.com>
X-Sender: wagnerc AT plebeian DOT com
User-Agent: Roundcube Webmail/1.3.7
X-IsSubscribed: yes

Hi Irfan,

I'm assuming that there is some reason you don't want to use the 
password option:
-w, --passwd <password>   Optional password for user. Only needed
                             if a user is given. If a user has an empty
                             password, enter `-w '. If a user is given 
but
                             no password, cygrunsrv will ask for a 
password
                             interactively.

The password prompt can be scripted with Perl.  (Assuming you *have* the 
password)

use IO::Pty::Easy;
$io = IO::Pty::Easy->new;
@cmd = qw{cygrunsrv -I name -t manual -p /c/foo.exe -u name};
$io->spawn(@cmd);
printf "read: %s\n", $io->read;
printf "write: %s\n", $io->write("foo\n");
printf "read: %s\n", $io->read;
printf "write: %s\n", $io->write("foo\n");
printf "read: %s\n", $io->read;
$io->close;


Hope that helps.
-Chris


On 2019-05-19 11:49 pm, Irfan Adilovic wrote:
> Hi,
> 
> (All actions here assume an elevated mintty terminal)
> 
> I have the  need to automate the installation of autossh as a windows
> service (=> several dozen autossh services) and when installing as a
> local user, the password prompt is an issue.
> 
> Is there a way to add windows services with cygrunsrv from an elevated
> mintty bash shell to run as a local user, somehow without requiring
> that local user's password each time the service is installed?


--
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