cygrunsrv --install <svc> --user <user>: avoid having to enter the user's password
Chris Wagner
wagnerc@plebeian.com
Tue May 21 02:20:00 GMT 2019
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
More information about the Cygwin
mailing list