Cygwin ssh: lost connection after accessing remote host with id_rsa, id_rsa.pub keys
<p>My goal is to copy files programatically from remote server to local computer. Both running Windows with Cygwin (server) and computer Cygwin 64.</p>

<p>Before I create rsa or dsa keys I can copy files by entering Password</p>

<p>But after creation of these files, I have "connection closed by remote host. lost connection" error</p>

<p>I gave following rights: "chmod 600 .ssh/id_rsa" (on local computer) and chmod 600 ".ssh/authorized_keys2". What is the problem who can answer to me?</p>

<pre><code>    $ ssh login@hiddenhost
    Connection to hiddenhost closed by remote host.
    Connection to hiddenhost closed.

    PC003370+procserver@ATMPROCSERVER ~
    $ ssh -v login@hiddenhost
    OpenSSH_7.2p2, OpenSSL 1.0.2g  1 Mar 2016
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to hiddenhost [hiddenhost] port 22.
    debug1: Connection established.
    debug1: identity file /home/procserver/.ssh/id_rsa type 1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/procserver/.ssh/id_ed25519-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.2
    debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
    debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
    debug1: Authenticating to hiddenhost:22 as 'login'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: curve25519-sha256@libssh.org
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    debug1: kex: server-&gt;client cipher: chacha20-poly1305@openssh.com MAC: &lt;implicit
    &gt; compression: none
    debug1: kex: client-&gt;server cipher: chacha20-poly1305@openssh.com MAC: &lt;implicit
    &gt; compression: none
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: ecdsa-sha2-nistp256 SHA256:TS6tXfpxXyW/KeIWFnvxCsmEhHy8
    8NyoBA3DdOHzjFw
    debug1: Host 'hiddenhost' is known and matches the ECDSA host key.
    debug1: Found key in /home/procserver/.ssh/known_hosts:1
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password,keyboard-interacti
    ve
    debug1: Next authentication method: publickey
    debug1: Offering RSA public key: /home/procserver/.ssh/id_rsa
    debug1: Authentication succeeded (publickey).
    Authenticated to hiddenhost ([hiddenhost]:22).
    debug1: channel 0: new [client-session]
    debug1: Requesting no-more-sessions@openssh.com
    debug1: Entering interactive session.
    debug1: pledge: network
    debug1: channel 0: free: client-session, nchannels 1
    Connection to hiddenhost closed by remote host.
    Connection to hiddenhost closed.
    Transferred: sent 1944, received 1312 bytes, in 0.0 seconds
    Bytes per second: sent 647995.5, received 437330.3
    debug1: Exit status -1

    PC003370+procserver@ATMPROCSERVER ~
    $
</code></pre>