Running SSHD On Cygwin

This was a pain. Apparently, sshd is one of those cygwin things that is really difficult to get fully working. In theory, you can install it as a Windows service, but it never worked for me. Instead, I rigged up an 'at' job to start it a few minutes after I log in.

First, configure the host keys, etc.:

    ssh-host-config

Say "no" if it asks for priv separation, and "no" to run it as a service. Say yes to everything else.

I start the process with a little batch script that looks like this, placed in my Windows startup folder.

    set HOUR=%time:~0,2%
    set MINUTE=%time:~3,2%
    set /A MINUTE=%MINUTE% + 2
    if %MINUTE% LSS 10 set MINUTE=0%MINUTE%
    set STARTTIME=%HOUR%:%MINUTE%
    
    set CYGWIN=binmode tty ntsec
    at %STARTTIME% c:\cygwin\bin\bash.exe --login -c /usr/sbin/sshd

Note: Do NOT run sshd as any normal user, even an admin user. It screws up permissions, and you will have to remove cygwin completely and reinstall to fix it. If you want to start sshd by hand to look at the output, create a Cygwin system-owned command prompt and start it from there.

Once you have it set up, you should be able to connect in with an ssh client (either PuTTY or the Cygwin built-in client). Only users that you have placed into the profile will be allowed to log in.

If you want to create public keys for your users, then log in as a user and execute:

   ssh-user-config

This creates ~/.ssh and generates a key, etc.

RunningSshdOnCygwin (last edited 2010-05-28 17:28:58 by KennethPronovici)