Skip to content

Instantly share code, notes, and snippets.

@kwart
Created June 1, 2016 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwart/f065a811d311fcaaf914534d3ccf3604 to your computer and use it in GitHub Desktop.
Save kwart/f065a811d311fcaaf914534d3ccf3604 to your computer and use it in GitHub Desktop.
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
@kwart
Copy link
Author

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