I installed openssh as a service with the help of cygwin using this tutorial
I can ssh into localhost from cygwin.
However, when I try to do this from putty, I get a "server refused our key" error.

During the setup process, id_rsa and id_rsa.pub were generated in the .ssh folder.
I took the id_rsa file, imported it into puttygen and generated private.ppk file.
I created a session in putty to use the private key.

When I try to log in, it prompts me for the username. After I enter my username, I get a "refused our key" error, and it attempts to use password authentication.

I would appreciate any help.


In case it helps, here's an output of a successful SSH to localhost from cygwin

$ ssh -v localhost
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/Pasha/.ssh/id_rsa type 1
debug1: identity file /home/Pasha/.ssh/id_rsa-cert type -1
debug1: identity file /home/Pasha/.ssh/id_dsa type -1
debug1: identity file /home/Pasha/.ssh/id_dsa-cert type -1
debug1: identity file /home/Pasha/.ssh/id_ecdsa type -1
debug1: identity file /home/Pasha/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0
debug1: match: OpenSSH_6.0 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 7a:52:.........
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/Pasha/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/Pasha/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([::1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
Last login: Tue Jul 17 00:14:52 2012 from ::1

The ssh-user-config program generates an SSH keypair (~/.ssh/id_rsa and ~/.ssh/id_rsa.pub) for the user you are currently logged in as, and if you choose to, adds that to ~/.ssh/authorized_keys, where ~ probably refers to /cygdrive/c/cygwin/home or C:\cygwin\home.

Therefore, you need to log in as the same user you ran ssh-user-config as. (This is neither cyg_server nor sshd, which are special accounts used for the SSH login process.)

  • Well, for whatever reason your answer got me to realize that I was entering an incorrect username. I was messing up my capitalization. – PBG Jul 17 '12 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.