I've two windows machine and trying to SSH using CYGWIN. It works fine when password prompted. However, when I generated the private/public pair, looks like authentication succeeded, but got the connection closed error.

Here's the detail logs: Please help

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: /home/502537203/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to hostname ([x.x.x.x]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)

Connection to hostname closed by remote host.
Connection to hostname closed.
Transferred: sent 2056, received 1500 bytes, in 0.0 seconds
debug1: Exit status -1
  • I generated this log via ssh -vvv to the remote server and also placed the authorized_keys as well
    – Kamal
    Commented Nov 16, 2016 at 18:34
  • 1
    You're doing your part just fine, it's the remote server that closes the connection. Look at the logs of the remote machine. Commented Nov 16, 2016 at 18:42
  • In which location of the server, I need to check for logs.
    – Kamal
    Commented Nov 16, 2016 at 19:11
  • Check under \cygwin\var\log\messages
    – stark
    Commented Nov 16, 2016 at 19:14
  • I've only below four files under /var/log -> setup.log, setup.log.full, sshd.log (no data), lastlog (huge data). Which one to check?
    – Kamal
    Commented Nov 16, 2016 at 19:22

3 Answers 3


It's working now. I did the following

  1. set the permission for ~/.ssh 0700
  2. all the files under ~/.ssh 0600
  3. run the sshd service as cyg_server id (created during ssh-host-config)
  4. edit /etc/sshd_config to allow PubkeyAuthentication yes
  • 3
    There is a debug1: Authentication succeeded (publickey)., so this and the other answers are wrong (for this specific case) Commented Jan 14, 2020 at 13:02

Incompatible ciphers can get negotiated. Try this:

ssh -oCiphers=aes128-ctr user@host



I saw the same error when i tried to ssh to Synology, as i needed to use Borg Backup. The problem was that i was trying to connect TO a user that wasn't the admin, even though all permissions were correct. When i tried to ssh to the user that was superadmin, connection was not dropped. I don't know if this helps, but this is my experience with this error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .