0

I am trying to establish a connection to a Windows machine using RSA key pairs. I have generated key pairs using ssh -keygen (4096 bits keys) and also copied my public key to users/myuser/.ssh/authorized_keys and also set the permissions by executing the below command:

ssh --% user1@domain1@contoso.com powershell -c $ConfirmPreference = 'None'; Repair-AuthorizedKeyPermissionC:\Users\user1\.ssh\authorized_keys

When I am trying to connect to that server using ssh agent or by using putty with the private key, it's asking to type a password and it is not doing any key based authentication. I have tried different approaches but am clueless. Can anyone tell me what I am doing wrong here?

Please find the log below:

PS C:\users\vkode200\.ssh> ssh -v vkode200@HQSWL-1615314
OpenSSH_for_Windows_7.9p1, LibreSSL 2.6.5
debug1: Connecting to hqswl-1615314 [fe80::12cd%47] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\vkode200/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\vkode200/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_7.9
debug1: match: OpenSSH_for_Windows_7.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to hqswl-1615314:22 as 'vkode200'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:b3Ij4O5n6NA93BktVQSIqZHLrLGba6wZfpm25utMRSY
debug1: Host 'hqswl-1615314' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\vkode200/.ssh/known_hosts:1
Warning: Permanently added the ECDSA host key for IP address 'fe80::12cd%47' to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: vkode200@CABLE@HQSWL-1615314 ED25519 SHA256:ab7l+m/NoV2p3a8bB4Aqy9ocgqcM48p9czneTRZ3PVE agent
debug1: Will attempt key: cable\\vkode200@HQSWL-1615314 RSA SHA256:HIxB9YslBxVqaKVG8rpCi1iww6jLtf4RSqdhqfdY11Q agent
debug1: Will attempt key: C:\\Users\\vkode200/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\vkode200/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\vkode200/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\vkode200/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\vkode200/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: vkode200@CABLE@HQSWL-1615314 ED25519 SHA256:ab7l+m/NoV2p3a8bB4Aqy9ocgqcM48p9czneTRZ3PVE agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: cable\\vkode200@HQSWL-1615314 RSA SHA256:HIxB9YslBxVqaKVG8rpCi1iww6jLtf4RSqdhqfdY11Q agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\\Users\\vkode200/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\vkode200/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\vkode200/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\vkode200/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\vkode200/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
vkode200@hqswl-1615314's password:

Please find below log after passing private key path:

PS C:\users\vkode200\.ssh> ssh -v -i "C:\Users\vkode200\.ssh\sud_key" vkode200@HQSWL-1615314
OpenSSH_for_Windows_7.9p1, LibreSSL 2.6.5
debug1: Connecting to hqswl-1615314 [fe80::5a%8] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\vkode200\\.ssh\\sud_key type 0
debug1: identity file C:\\Users\\vkode200\\.ssh\\sud_key-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_7.9
debug1: match: OpenSSH_for_Windows_7.9 pat OpenSSH* compat 0x04000000
debug1: Authenticating to hqswl-1615314:22 as 'vkode200'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:b3Ij4O5n6NA93BktVQSIqZHLrLGba6wZfpm25utMRSY
debug1: Host 'hqswl-1615314' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\vkode200/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: C:\\Users\\vkode200\\.ssh\\sud_key RSA SHA256:HIxB9YslBxVqaKVG8rpCi1iww6jLtf4RSqdhqfdY11Q explicit agent
debug1: Will attempt key: vkode200@CABLE@HQSWL-1615314 ED25519 SHA256:ab7l+m/NoV2p3a8bB4Aqy9ocgqcM48p9czneTRZ3PVE agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\vkode200\\.ssh\\sud_key RSA SHA256:HIxB9YslBxVqaKVG8rpCi1iww6jLtf4RSqdhqfdY11Q explicit agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: vkode200@CABLE@HQSWL-1615314 ED25519 SHA256:ab7l+m/NoV2p3a8bB4Aqy9ocgqcM48p9czneTRZ3PVE agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
vkode200@hqswl-1615314's password:
  • Log file please. – Martin Prikryl Mar 23 at 10:39
  • Hi Martin , added log to main thread. My private key name is sud_key, i logs i did not see that was used. – user1010691 Mar 23 at 17:17
  • So what did you do to "provide the generated private key" to ssh? – Martin Prikryl Mar 23 at 20:29
  • 1
    ?? There's no -Filepath argument in ssh - Where did you see that? There's -i switch for that. -- Not to mention that your question does not show any -Filepath argument anyway. – Martin Prikryl Mar 24 at 8:30
  • 1
    Sorry, its typo tried with -i by giving path to my private key but no luck, added the log for the same in main thread. – user1010691 Mar 24 at 13:52

Your Answer

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

Browse other questions tagged or ask your own question.