title: Setting up OpenSSH for Windows using public key authentication
body: <p>I am having issues setting up OpenSSH for Windows, using public key authentication.</p>
  <p>I have this working on my local desktop and can ssh with a key from Unix machines or other OpenSSH for Windows machines.</p>
  <p>I have replicated the build onto a server, I can get password authentication working fine, but when I use the keys I get the following issue:</p>
  <pre><code>debug1: Authentications that can continue: publickey,password,keyboard-interactive
  debug3: start over, passed a different list publickey,password,keyboard-interactive
  debug3: preferred publickey,keyboard-interactive,password
  debug3: authmethod_lookup publickey
  debug3: remaining preferred: keyboard-interactive,password
  debug3: authmethod_is_enabled publickey
  debug1: Next authentication method: publickey
  debug1: Offering RSA public key: /cygdrive/c/sshusers/jsadmint2232/.ssh/id_rsa
  debug3: send_pubkey_test
  debug2: we sent a publickey packet, wait for reply
  Connection closed by 127.0.0.1
  </code></pre>
  <p>So for the purposes of testing, I have been just trying to SSH to localhost, but even when tried remotely I get the same issue.</p>
  <p>Even more strange, is that when I have both password and public key enabled in <code>sshd_config</code>, it will only attempt to use keys and then bomb out with the above message and won't even try to use password.</p>
  <p>Here are the steps I have taken:</p>
  <ol>
  <li>Install OpenSSH for Windows</li>
  <li><code>mkgroup -l &gt;&gt;..\etc\group</code> (added local groups)</li>
  <li><code>mkgroup -d &gt;&gt;..\etc\group</code> (added domain groups)</li>
  <li><code>mkpasswd -L -u openssh &gt;&gt;..\passwd</code> (added my local user)</li>
  <li><code>mkpasswd -D -u jsadmint2232 &gt;&gt;..\passwd</code> (added my domain user)</li>
  <li>Edited the homedir in file <em>passwd</em> to point to c:\sshusers%USER% - where %USER% is the user name</li>
  <li>Enabled password authentication, disabled key authentication</li>
  <li>Created SSH keys for both jsadmint2232 / OpenSSH and ensured that the files were created in home directories</li>
  <li>Added authorized_keys files into .ssh directories for each user and added keys for incoming connecting users</li>
  <li><code>net stop opensshd</code> / <code>net start opensshd</code></li>
  <li>Test if password authentication works both locally and remotely</li>
  <li>Updated sshd_config, to enabled key auth - restart opensshd</li>
  <li>Test connection and get above error. Also, it doesn't even try password authentication.</li>
  <li>Updated sshd_config, to disable password authentication completely - restart opensshd</li>
  <li>Test connection and still get above error</li>
  </ol>
  <p>It appears the server is killing the connection for some reason.</p>