Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Cygwin sshd service regenerates /etc/passwd with local users when the service is started
--- ssh-host-config.orig 2016-06-01 17:05:03.676035200 +0000
+++ ssh-host-config 2016-06-01 17:08:12.793684500 +0000
@@ -475,8 +475,9 @@
csih_inform "will start automatically after the next reboot."
fi
else
- if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /usr/sbin/sshd \
- -a "-D" -y tcpip "${cygwin_env[@]}" \
+ if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /bin/bash \
+-a "-c '/usr/bin/mkpasswd -l -b > /etc/passwd; /usr/sbin/sshd -D'" \
+ -y tcpip "${cygwin_env[@]}" \
-u "${run_service_as}" -w "${password}"
then
/usr/bin/editrights -u "${run_service_as}" -a SeServiceLogonRight
Owner

kwart commented Jun 1, 2016

ssh-host-config -y -c ntsec -u sshd_account -w ASecretPassword.123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment