public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Installing sshd with option --type manual
@ 2017-04-29  2:35 Charles Russell
  2017-05-04 20:31 ` Fran Litterio
  2017-05-06 17:28 ` Charles Russell
  0 siblings, 2 replies; 8+ messages in thread
From: Charles Russell @ 2017-04-29  2:35 UTC (permalink / raw)
  To: cygwin

Starting from a default installation of sshd that was working properly, 
I tried uninstalling sshd with cygrunsrv and reinstalling with --type 
manual.

(cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)

After rebooting I cannot start sshd with cygrunsrv.  Instead, I get 
message "Error starting a service: Query service status: Win32 Error 1062"

Is it practical to use "--type manual" with sshd, or are its security 
restrictions too tight for this kind of installation? My intent was to 
have sshd off by default, but available when I need it, with current 
status easily seen with ps.

Is there an easy fixup for my broken sshd, or should I rerun 
ssh-host-config?


--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-04-29  2:35 Installing sshd with option --type manual Charles Russell
@ 2017-05-04 20:31 ` Fran Litterio
  2017-05-07  0:18   ` Charles Russell
  2017-05-06 17:28 ` Charles Russell
  1 sibling, 1 reply; 8+ messages in thread
From: Fran Litterio @ 2017-05-04 20:31 UTC (permalink / raw)
  To: cygwin

On 4/28/2017 11:48 AM, Charles Russell wrote:
> Starting from a default installation of sshd that was working properly, 
> I tried uninstalling sshd with cygrunsrv and reinstalling with --type 
> manual.
> 
> (cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)
> 
> After rebooting I cannot start sshd with cygrunsrv.  Instead, I get 
> message "Error starting a service: Query service status: Win32 Error 1062"

You can try opening the Services Control Panel app (run "start 
services.msc" in a Command Prompt) and changing the startup type of 
service "Cygwin sshd" to "Automatic (Delayed Start)".

In theory, that was all you changed with your cygrunsrv command.

> Is it practical to use "--type manual" with sshd, or are its security 
> restrictions too tight for this kind of installation? My intent was to 
> have sshd off by default, but available when I need it, with current 
> status easily seen with ps.

I routinely stop sshd with "net stop sshd" and re-start it later with 
"net start sshd".  If it's configure for manual startup, these commands 
should work just as well.

 > [...] or should I rerun
 > ssh-host-config?

In cases where I have re-run ssh-host-config, I have first deleted the 
service with "sc delete sshd" as Administrator out of a desire not to 
confuse the config script with an existing service. But that may not be 
necessary.
--
Fran


--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-04-29  2:35 Installing sshd with option --type manual Charles Russell
  2017-05-04 20:31 ` Fran Litterio
@ 2017-05-06 17:28 ` Charles Russell
  1 sibling, 0 replies; 8+ messages in thread
From: Charles Russell @ 2017-05-06 17:28 UTC (permalink / raw)
  To: cygwin

On 4/28/2017 10:48 AM, Charles Russell wrote:
> Starting from a default installation of sshd that was working properly,
> I tried uninstalling sshd with cygrunsrv and reinstalling with --type
> manual.
>
> (cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)
>
> After rebooting I cannot start sshd with cygrunsrv.  Instead, I get
> message "Error starting a service: Query service status: Win32 Error 1062"
>
> Is it practical to use "--type manual" with sshd, or are its security
> restrictions too tight for this kind of installation? My intent was to
> have sshd off by default, but available when I need it, with current
> status easily seen with ps.
>
> Is there an easy fixup for my broken sshd, or should I rerun
> ssh-host-config?
>
>
With no response to this message, I reran ssh-host-config, which fixed 
the broken sshd and very kindly did not even require me to re-enter the 
pubkeys. It would be nice if it also offered an option for manual start.

Inspecting the ssh-host-config script, I see that installing the server 
requires some configuration options that I don't understand. I'm now 
using the firewall to disable the server by default, though "net start 
sshd" and "net stop sshd" would have been more convenient.

--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-05-04 20:31 ` Fran Litterio
@ 2017-05-07  0:18   ` Charles Russell
  2017-05-07  0:25     ` Charles Russell
  0 siblings, 1 reply; 8+ messages in thread
From: Charles Russell @ 2017-05-07  0:18 UTC (permalink / raw)
  To: cygwin cygwin

On 5/4/2017 3:31 PM, Fran Litterio wrote:
> On 4/28/2017 11:48 AM, Charles Russell wrote:
>> Starting from a default installation of sshd that was working
>> properly, I tried uninstalling sshd with cygrunsrv and reinstalling
>> with --type manual.
>>
>> (cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)
>>
>> After rebooting I cannot start sshd with cygrunsrv.  Instead, I get
>> message "Error starting a service: Query service status: Win32 Error
>> 1062"
>
> You can try opening the Services Control Panel app (run "start
> services.msc" in a Command Prompt) and changing the startup type of
> service "Cygwin sshd" to "Automatic (Delayed Start)".
>
> In theory, that was all you changed with your cygrunsrv command.
>
>> Is it practical to use "--type manual" with sshd, or are its security
>> restrictions too tight for this kind of installation? My intent was to
>> have sshd off by default, but available when I need it, with current
>> status easily seen with ps.
>
> I routinely stop sshd with "net stop sshd" and re-start it later with
> "net start sshd".  If it's configure for manual startup, these commands
> should work just as well.
>
>> [...] or should I rerun
>> ssh-host-config?
>
> In cases where I have re-run ssh-host-config, I have first deleted the
> service with "sc delete sshd" as Administrator out of a desire not to
> confuse the config script with an existing service. But that may not be
> necessary.
> --
> Fran
>
>


--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-05-07  0:18   ` Charles Russell
@ 2017-05-07  0:25     ` Charles Russell
  2017-05-07  3:27       ` Charles Russell
  2017-05-10  5:31       ` Charles Russell
  0 siblings, 2 replies; 8+ messages in thread
From: Charles Russell @ 2017-05-07  0:25 UTC (permalink / raw)
  To: cygwin

On 5/4/2017 3:31 PM, Fran Litterio wrote:
 > On 4/28/2017 11:48 AM, Charles Russell wrote:
 >> Starting from a default installation of sshd that was working
 >> properly, I tried uninstalling sshd with cygrunsrv and reinstalling
 >> with --type manual.
 >>
 >> (cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)
 >>
 >> After rebooting I cannot start sshd with cygrunsrv.  Instead, I get
 >> message "Error starting a service: Query service status: Win32 Error
 >> 1062"
 >
 > You can try opening the Services Control Panel app (run "start
 > services.msc" in a Command Prompt) and changing the startup type of
 > service "Cygwin sshd" to "Automatic (Delayed Start)".

I reran ssh-host-config and it restored the status quo ante, including 
pubkeys and all configuration.  However, even though sshd is working 
fine under Cygwin, it does not appear in Windows' list of services, so I 
cannot change the startup option there.

 >
 > In theory, that was all you changed with your cygrunsrv command.

Looking at the cygrunsrv command in ssh-host-config, installation of 
sshd requires some additional configuration options that I don't understand.

Thanks for your response.


--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-05-07  0:25     ` Charles Russell
@ 2017-05-07  3:27       ` Charles Russell
  2017-05-10  5:31       ` Charles Russell
  1 sibling, 0 replies; 8+ messages in thread
From: Charles Russell @ 2017-05-07  3:27 UTC (permalink / raw)
  To: cygwin

On 5/4/2017 3:31 PM, Fran Litterio wrote:
 > On 4/28/2017 11:48 AM, Charles Russell wrote:
 >> Starting from a default installation of sshd that was working
 >> properly, I tried uninstalling sshd with cygrunsrv and reinstalling
 >> with --type manual.
 >>
 >> (cygrunsrv --install sshd --path /usr/sbin/sshd.exe --type manual)
 >>
 >> After rebooting I cannot start sshd with cygrunsrv.  Instead, I get
 >> message "Error starting a service: Query service status: Win32 Error
 >> 1062"
 >
 > You can try opening the Services Control Panel app (run "start
 > services.msc" in a Command Prompt) and changing the startup type of
 > service "Cygwin sshd" to "Automatic (Delayed Start)".

I reran ssh-host-config and it restored the status quo ante, including 
pubkeys and all configuration.  However, even though sshd is working 
fine under Cygwin, it does not appear in Windows' list of services, so I 
cannot change the startup option there.

 >
 > In theory, that was all you changed with your cygrunsrv command.

Looking at the cygrunsrv command in ssh-host-config, installation of 
sshd requires some additional configuration options that I don't understand.

Thanks for your response.



--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-05-07  0:25     ` Charles Russell
  2017-05-07  3:27       ` Charles Russell
@ 2017-05-10  5:31       ` Charles Russell
  2017-05-10 18:01         ` Brian Inglis
  1 sibling, 1 reply; 8+ messages in thread
From: Charles Russell @ 2017-05-10  5:31 UTC (permalink / raw)
  To: cygwin


> On 5/4/2017 3:31 PM, Fran Litterio wrote:

>> You can try opening the Services Control Panel app (run "start
>> services.msc" in a Command Prompt) and changing the startup type of
>> service "Cygwin sshd" to "Automatic (Delayed Start)".

Yes! I was looking in the alphabetized list of services for sshd, not 
for CYGWIN sshd.

Thanks




--
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] 8+ messages in thread

* Re: Installing sshd with option --type manual
  2017-05-10  5:31       ` Charles Russell
@ 2017-05-10 18:01         ` Brian Inglis
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Inglis @ 2017-05-10 18:01 UTC (permalink / raw)
  To: cygwin

On 2017-05-09 23:05, Charles Russell wrote:
>> On 5/4/2017 3:31 PM, Fran Litterio wrote:
>>> You can try opening the Services Control Panel app (run "start 
>>> services.msc" in a Command Prompt) and changing the startup type
>>> of service "Cygwin sshd" to "Automatic (Delayed Start)".
> Yes! I was looking in the alphabetized list of services for sshd, not
> for CYGWIN sshd.

...or from an elevated admin shell where you installed the Cygwin 
service with cygrunsrv -I or ran the /bin/...-config script e.g.:

	$ sc config sshd start= delayed-auto depend= cygserver/tcpip

no space before = (part of option), space between = and value required, 
services it should start after and depends on separated by forward slashes.

From any shell, you can list installed Cygwin services using 

	$ cygrunsrv -L

with -V also listing all parameters and their values.

From any shell, you can also list and modify parameters easily using e.g.

$ regtool list -p /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd
Parameters\
Type
Start
ErrorControl
ImagePath
DisplayName
DependOnService
ObjectName
$ regtool set -d /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/DelayedAutostart 1
$ regtool list -p /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd
Parameters\
Type
Start
ErrorControl
ImagePath
DisplayName
DependOnService
ObjectName
DelayedAutostart
$ regtool get /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/DelayedAutostart
1
$ regtool list -p /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/Parameters
AppPath
AppArgs
$ regtool set -d /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/Parameters/Preshutdown 1
$ regtool list -p /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/Parameters
AppPath
AppArgs
Preshutdown
$ regtool get /HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/sshd/Parameters/Preshutdown
1

with the usual caveats regarding registry key names, changes, and 
modifications.
Parameters and other cygrunsrv changes will not be picked up until 
the service is stopped and restarted from cygrunsrv in an elevated 
admin shell.

This approach has the advantages that cygrunsrv does not support 
service or parameter changes or modifications, cygrunsrv -I and 
sc config require an elevated admin shell, sc config does not support 
cygrunsrv and other services' Parameters and other features, and 
regedit requires formatted file input or a GUI.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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] 8+ messages in thread

end of thread, other threads:[~2017-05-10 17:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29  2:35 Installing sshd with option --type manual Charles Russell
2017-05-04 20:31 ` Fran Litterio
2017-05-07  0:18   ` Charles Russell
2017-05-07  0:25     ` Charles Russell
2017-05-07  3:27       ` Charles Russell
2017-05-10  5:31       ` Charles Russell
2017-05-10 18:01         ` Brian Inglis
2017-05-06 17:28 ` Charles Russell

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