public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
@ 2019-05-20  3:49 Irfan Adilovic
  2019-05-21  2:20 ` Chris Wagner
  2019-05-22 21:35 ` Andrey Repin
  0 siblings, 2 replies; 4+ messages in thread
From: Irfan Adilovic @ 2019-05-20  3:49 UTC (permalink / raw)
  To: cygwin

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?

So far my only solution was to install the services to run as the
default SYSTEM user which doesn't require a password, and to
cron-rsync the necessary ~local-user/.ssh/config and private keys to
the ~SYSTEM/.ssh, with appropriate ownership and permissions fixes.
But this is ugly and I'm hoping for a better solution.

(Another solution would be to somehow share the ~.ssh/ between the
local user and SYSTEM, but given the security constraints on that
folder and its contents, I don't think this is feasible -- but I'll
gladly see me wrong on this, if there's an approach)

-- Irfan

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
  2019-05-20  3:49 cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password Irfan Adilovic
@ 2019-05-21  2:20 ` Chris Wagner
  2019-05-22 16:31   ` Irfan Adilovic
  2019-05-22 21:35 ` Andrey Repin
  1 sibling, 1 reply; 4+ messages in thread
From: Chris Wagner @ 2019-05-21  2:20 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
  2019-05-21  2:20 ` Chris Wagner
@ 2019-05-22 16:31   ` Irfan Adilovic
  0 siblings, 0 replies; 4+ messages in thread
From: Irfan Adilovic @ 2019-05-22 16:31 UTC (permalink / raw)
  To: cygwin

On Tue, 21 May 2019 at 04:20, Chris Wagner <wagnerc@plebeian.com> wrote:
>
> 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.

Nope, no reason, I completely missed this option... While I was hoping
to not have to enter any password (like for SYSTEM, but I guess that
account's special) -- this is also fine, thanks a lot.

-- Irfan

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
  2019-05-20  3:49 cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password Irfan Adilovic
  2019-05-21  2:20 ` Chris Wagner
@ 2019-05-22 21:35 ` Andrey Repin
  1 sibling, 0 replies; 4+ messages in thread
From: Andrey Repin @ 2019-05-22 21:35 UTC (permalink / raw)
  To: Irfan Adilovic, cygwin

Greetings, Irfan Adilovic!

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

This is not an issue, this is a requirement of the OS.

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

Nothing can be done about it, except providing the password it is asking for.


-- 
With best regards,
Andrey Repin
Thursday, May 23, 2019 0:29:04

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-22 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20  3:49 cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password Irfan Adilovic
2019-05-21  2:20 ` Chris Wagner
2019-05-22 16:31   ` Irfan Adilovic
2019-05-22 21:35 ` Andrey Repin

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