diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cygwin/ssh-host-config | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index 301d5eb6e..eb67221b1 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config | |||
@@ -61,6 +61,7 @@ LOCALSTATEDIR=/var | |||
61 | 61 | ||
62 | sshd_config_configured=no | 62 | sshd_config_configured=no |
63 | port_number=22 | 63 | port_number=22 |
64 | service_name=sshd | ||
64 | strictmodes=yes | 65 | strictmodes=yes |
65 | privsep_used=yes | 66 | privsep_used=yes |
66 | cygwin_value="" | 67 | cygwin_value="" |
@@ -408,7 +409,7 @@ install_service() { | |||
408 | local ret=0 | 409 | local ret=0 |
409 | 410 | ||
410 | echo | 411 | echo |
411 | if /usr/bin/cygrunsrv -Q sshd >/dev/null 2>&1 | 412 | if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1 |
412 | then | 413 | then |
413 | csih_inform "Sshd service is already installed." | 414 | csih_inform "Sshd service is already installed." |
414 | check_service_files_ownership "" || let ret+=$? | 415 | check_service_files_ownership "" || let ret+=$? |
@@ -464,7 +465,7 @@ install_service() { | |||
464 | fi | 465 | fi |
465 | if [ -z "${password}" ] | 466 | if [ -z "${password}" ] |
466 | then | 467 | then |
467 | if /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ | 468 | if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /usr/sbin/sshd \ |
468 | -a "-D" -y tcpip "${cygwin_env[@]}" | 469 | -a "-D" -y tcpip "${cygwin_env[@]}" |
469 | then | 470 | then |
470 | echo | 471 | echo |
@@ -474,20 +475,20 @@ install_service() { | |||
474 | csih_inform "will start automatically after the next reboot." | 475 | csih_inform "will start automatically after the next reboot." |
475 | fi | 476 | fi |
476 | else | 477 | else |
477 | if /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ | 478 | if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /usr/sbin/sshd \ |
478 | -a "-D" -y tcpip "${cygwin_env[@]}" \ | 479 | -a "-D" -y tcpip "${cygwin_env[@]}" \ |
479 | -u "${run_service_as}" -w "${password}" | 480 | -u "${run_service_as}" -w "${password}" |
480 | then | 481 | then |
481 | /usr/bin/editrights -u "${run_service_as}" -a SeServiceLogonRight | 482 | /usr/bin/editrights -u "${run_service_as}" -a SeServiceLogonRight |
482 | echo | 483 | echo |
483 | csih_inform "The sshd service has been installed under the '${run_service_as}'" | 484 | csih_inform "The sshd service has been installed under the '${run_service_as}'" |
484 | csih_inform "account. To start the service now, call \`net start sshd' or" | 485 | csih_inform "account. To start the service now, call \`net start ${service_name}' or" |
485 | csih_inform "\`cygrunsrv -S sshd'. Otherwise, it will start automatically" | 486 | csih_inform "\`cygrunsrv -S ${service_name}'. Otherwise, it will start automatically" |
486 | csih_inform "after the next reboot." | 487 | csih_inform "after the next reboot." |
487 | fi | 488 | fi |
488 | fi | 489 | fi |
489 | 490 | ||
490 | if /usr/bin/cygrunsrv -Q sshd >/dev/null 2>&1 | 491 | if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1 |
491 | then | 492 | then |
492 | check_service_files_ownership "${run_service_as}" || let ret+=$? | 493 | check_service_files_ownership "${run_service_as}" || let ret+=$? |
493 | else | 494 | else |
@@ -561,6 +562,11 @@ do | |||
561 | shift | 562 | shift |
562 | ;; | 563 | ;; |
563 | 564 | ||
565 | -N | --name ) | ||
566 | service_name=$1 | ||
567 | shift | ||
568 | ;; | ||
569 | |||
564 | -p | --port ) | 570 | -p | --port ) |
565 | port_number=$1 | 571 | port_number=$1 |
566 | shift | 572 | shift |
@@ -590,6 +596,7 @@ do | |||
590 | echo " --yes -y Answer all questions with \"yes\" automatically." | 596 | echo " --yes -y Answer all questions with \"yes\" automatically." |
591 | echo " --no -n Answer all questions with \"no\" automatically." | 597 | echo " --no -n Answer all questions with \"no\" automatically." |
592 | echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var." | 598 | echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var." |
599 | echo " --name -N <name> sshd windows service name." | ||
593 | echo " --port -p <n> sshd listens on port n." | 600 | echo " --port -p <n> sshd listens on port n." |
594 | echo " --user -u <account> privileged user for service, default 'cyg_server'." | 601 | echo " --user -u <account> privileged user for service, default 'cyg_server'." |
595 | echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user." | 602 | echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user." |