Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Winscp cmd line with private key failed - Server refused our key

Please attach a complete session log files both from GUI and script using the latest version of WinSCP.
iamvlganesh

Winscp cmd line with private key failed - Server refused our key

Hi All,

I am able to login into a SFTP server manually with a private via WinSCP 5.7.2 but failed to connect via script.
Below details for reference:
>winscp /script=script.txt /log=C:\Temp\sftp.log
option batch off
option confirm off
open sftp://NEUSER:N3020@3.125.64.21 -privatekey=D:\\key.ppk -Passphrase=N3020
cd /sftp-boubyan
put "C:\Temp\file.zip.gpg"
# Disconnect
close
exit


Log:
. 2020-01-18 13:51:25.823 Server version: SSH-2.0-AWS_SFTP_1.0
. 2020-01-18 13:51:25.823 Using SSH protocol version 2
. 2020-01-18 13:51:25.823 We claim version: SSH-2.0-WinSCP_release_5.7.2
. 2020-01-18 13:51:26.026 Using Diffie-Hellman with standard group "group14"
. 2020-01-18 13:51:26.026 Doing Diffie-Hellman key exchange with hash SHA-1
. 2020-01-18 13:51:26.339 Verifying host key rsa2 0x10001,0xbe7dd3f3c1c13e6a c4d9c68d9aaf4946 90b39a88ea2fe5f0 ccaae0313b1c405e 18677cd061fc2617 aeaef1cc3ab228b8 18215a2ef86df26e ee1db70f2202cc7d 1b4fc95e25d9b844 644b25572f8ac176 c10bec2c2f5df427 60a7a760f5b0cc1f 1e0eb7d8e096bef2 67addcc0a82cb608 2c7e7d03bf00fe26 4f133395726b48fa acad1ae2ef39db6c df76b6983842dc51 55f8d9db7bb62d5d d4410859d2372331 cfbafd9d758f1990 a7976c28e4a3a11b c832fa52182951fb 5d27e9c36924e482 874555d61d2ae993 29fff279a18f5a3f 27b82230e10ac26c d4ef60a0e5d4bd52 04fe176a708a80b4 763d0f9ac8f08ed0 daf940808152885d 238e03167cd99453 with fingerprint ssh-rsa 2048 76:c0:c6:ee:86:0c:9f:70:58:81:5b:46:83:96:97:6e
. 2020-01-18 13:51:26.354 Host key matches cached key
. 2020-01-18 13:51:26.354 Host key fingerprint is:
. 2020-01-18 13:51:26.354 ssh-rsa 2048 76:c0:c6:ee:86:0c:9f:70:58:81:5b:46:83:96:97:6e
. 2020-01-18 13:51:26.354 Initialised AES-256 SDCTR client->server encryption
. 2020-01-18 13:51:26.354 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2020-01-18 13:51:26.354 Initialised AES-256 SDCTR server->client encryption
. 2020-01-18 13:51:26.354 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2020-01-18 13:51:26.714 Reading private key file "D:\\key.ppk"
! 2020-01-18 13:51:26.714 Using username "NEUSER".
. 2020-01-18 13:51:26.901 Offered public key
! 2020-01-18 13:51:27.886 Server refused our key
. 2020-01-18 13:51:27.886 Server refused our key
. 2020-01-18 13:51:27.886 Disconnected: No supported authentication methods available (server sent: publickey)