Remotely Starting Cygwin sshd on Windows 7

0

Our network consists of Windows 7 SP1 machines. We have Cygwin installed on these machines, including the Cygwin sshd SSH server.

One machine in particular (call it host H) is used heavily by several people. Most of what we need to do can be done via the command line. So, one person works at the machine and gets to use the normal Windows GUI interface. The rest of us just ssh in since Windows 7 will allow only one GUI session (preventing anybody from RDPing in).

sshd occasionally dies and therefore needs to be restarted. RDPing in to do so is not an option because doing so would boot the person working directly at the workstation off. Those of us working via SSH are working remotely, so we can't simply walk over and ask the person at the workstation to execute "net start sshd" for us.

So, here's the bottom line of all this...

Is there a way to remotely start sshd (via "net start sshd") without RDPing into the system to do so???

Dave

Posted 2017-06-13T12:51:00.937

Reputation: 597

>

  • Couldn't you use directly a virtual machine with linux and sshd inside? Eventually even an sshd listening on a different port... 2. What about an sshd run out of Cygwin (you do not need RDPing) 3. A script that checks if is up sshd else start it again from inside Cygwin.
  • < – Hastur – 2017-06-13T13:02:50.680

    No, I'm afraid not. The Windows 7 physical host is the machine we need to be working on. There are no VMs running in this scenario, and there is no hypervisor available. – Dave – 2017-06-13T13:05:05.307

    So you need to run windows programs from inside Cygwin... because with Virtualbox you can have access to the disk (or to a part of it)... As alternative to "walk over and ask" it exists a wide number of chat available (from google, skype, telegram ... etc etc etc). BTW you can always run a script within Cygwin, a never ending cycle something like while : ; do ; pgrep sshd && echo yes || echo no ; sleep 2s; done. Change time 2s in what you need and echo no with the command to restart the sshd. Note: maybe it's needed to run it in Cygwin by the RDP user and he has not to close Cygwin. – Hastur – 2017-06-13T13:14:56.853

    Well, the machine is often left locked with long-running tasks being executed. So, the person is often not physically there to chat with. :( So, it needs to be a technical solution. – Dave – 2017-06-13T13:18:49.723

    I've been thinking about something along the lines of the other solution you suggested (the while loop). Sort of a watchdog kind of thing... – Dave – 2017-06-13T13:19:36.147

    The problem with the bash script is that I don't know what it will happen if the Cygwin session (from which you run it) crashes or it is closed. It is not running below init that will take the orphan. BTW I suppose you can do a similar script from windows too, let it run, check when sshd is down and start a Cygwin+ssd again when needed. PS> you can use as a working rule that if the RDP user goes away disconnect himself, so another user can make it start when in case of need. – Hastur – 2017-06-13T13:29:48.333

    No answers