Disconnected: No supported authentication methods available (server sent: publickey)
Authentication log (see session log for details):
Unable to use key file "C:\doaprivatekey.pkk" (unable to open file)
Using username "npcs".
Authentication failed.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "xxx.xx.xx.xxx",
UserName = "npcs",
Password = "",
PortNumber = 2022,
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx",
SshPrivateKeyPath = "C:\\doaprivatekey.pkk",
PrivateKeyPassphrase ="xxxxxxxx",
};
using (Session session = new Session())
{
session.SessionLogPath = @"D:\1gfmas\dev\winscpError.log";
session.Open(sessionOptions);
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FilePermissions = null;
transferOptions.PreserveTimestamp = false;
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;
TransferOperationResult transferResult;
transferResult = session.PutFiles(@"D:\GPGFILE\*", "/IN/", false, transferOptions);
transferResult.Check();
}
. 2017-03-27 14:15:00.395 --------------------------------------------------------------------------
. 2017-03-27 14:15:00.395 WinSCP Version 5.9.4 (Build 7333) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Enterprise)
. 2017-03-27 14:15:00.395 Configuration: nul
. 2017-03-27 14:15:00.395 Log level: Normal
. 2017-03-27 14:15:00.395 Local account: nameserver\administrator2
. 2017-03-27 14:15:00.395 Working directory: D:\application\gfmas\NPCS\bin
. 2017-03-27 14:15:00.395 Process ID: 2576
. 2017-03-27 14:15:00.396 Command-line: "D:\application\gfmas\NPCS\bin\winscp.exe" /xmllog="C:\Users\administrator2\AppData\Local\Temp\6\wscp0C7C.02DD2365.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=594 /ini=nul /log="D:\1gfmas\dev\winscpError.log" /console /consoleinstance=_3196_32906651_933
. 2017-03-27 14:15:00.396 Time zone: Current: GMT+8 (Malay Peninsula Standard Time), No DST
. 2017-03-27 14:15:00.396 Login time: Monday, March 27, 2017 2:15:00 PM
. 2017-03-27 14:15:00.396 --------------------------------------------------------------------------
. 2017-03-27 14:15:00.396 Script: Retrospectively logging previous script records:
> 2017-03-27 14:15:00.396 Script: option batch on
< 2017-03-27 14:15:00.396 Script: batch on
< 2017-03-27 14:15:00.396 Script: reconnecttime 120
> 2017-03-27 14:15:00.396 Script: option confirm off
< 2017-03-27 14:15:00.396 Script: confirm off
> 2017-03-27 14:15:00.396 Script: option reconnecttime 120
< 2017-03-27 14:15:00.396 Script: reconnecttime 120
> 2017-03-27 14:15:00.396 Script: open sftp://npcs@xxx.xx.xx.xxx:2022 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" -privatekey="C:\doaprivatekey.pkk" -passphrase=*** -timeout=15
. 2017-03-27 14:15:00.396 --------------------------------------------------------------------------
. 2017-03-27 14:15:00.396 Session name: npcs@xxx.xx.xx.xxx (Ad-Hoc site)
. 2017-03-27 14:15:00.396 Host name: xxx.xx.xx.xxx (Port: 2022)
. 2017-03-27 14:15:00.396 User name: npcs (Password: No, Key file: Yes, Passphrase: Yes)
. 2017-03-27 14:15:00.396 Tunnel: No
. 2017-03-27 14:15:00.396 Transfer Protocol: SFTP
. 2017-03-27 14:15:00.396 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2017-03-27 14:15:00.396 Disable Nagle: No
. 2017-03-27 14:15:00.396 Proxy: None
. 2017-03-27 14:15:00.396 Send buffer: 262144
. 2017-03-27 14:15:00.396 SSH protocol version: 2; Compression: No
. 2017-03-27 14:15:00.396 Bypass authentication: No
. 2017-03-27 14:15:00.396 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2017-03-27 14:15:00.396 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-03-27 14:15:00.396 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2017-03-27 14:15:00.396 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2017-03-27 14:15:00.396 Simple channel: Yes
. 2017-03-27 14:15:00.396 Return code variable: Autodetect; Lookup user groups: Auto
. 2017-03-27 14:15:00.396 Shell: default
. 2017-03-27 14:15:00.396 EOL: LF, UTF: Auto
. 2017-03-27 14:15:00.396 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2017-03-27 14:15:00.396 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-03-27 14:15:00.396 SFTP Bugs: Auto,Auto
. 2017-03-27 14:15:00.396 SFTP Server: default
. 2017-03-27 14:15:00.396 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-03-27 14:15:00.397 Cache directory changes: Yes, Permanent: Yes
. 2017-03-27 14:15:00.397 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2017-03-27 14:15:00.397 DST mode: Unix
. 2017-03-27 14:15:00.397 --------------------------------------------------------------------------
. 2017-03-27 14:15:00.397 Looking up host "xxx.xx.xx.xxx" for SSH connection
. 2017-03-27 14:15:00.397 Connecting to xxx.xx.xx.xxx port 2022
. 2017-03-27 14:15:00.402 We claim version: SSH-2.0-WinSCP_release_5.9.4
. 2017-03-27 14:15:00.407 Server version: SSH-2.0-Unknown
. 2017-03-27 14:15:00.407 We believe remote version has SSH-2 channel request bug
. 2017-03-27 14:15:00.407 Using SSH protocol version 2
. 2017-03-27 14:15:00.407 Have a known host key of type rsa2
. 2017-03-27 14:15:00.408 Doing Diffie-Hellman group exchange
. 2017-03-27 14:15:00.414 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-27 14:15:01.245 Server also has ssh-dss host key, but we don't know it
. 2017-03-27 14:15:01.245 Host key fingerprint is:
. 2017-03-27 14:15:01.245 ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
. 2017-03-27 14:15:01.245 Verifying host key rsa2 0x25,0xb05f8f8ec0d1fd7f 33dbcfd6ec343fed 239d7da13a50ea41 a63db4f6d7c18c9a d461b9ece09845d1 68701bbc3b37896f 373f549a2ac7a888 e93c6a88a8d022ba 941d03a6fa78e843 ff366c135025404e 5dd00e97266c5e31 f831db2fb80f6e0a 7fb8f050214372d0 a1035c2b3dba98ee 69d1c18f11e6b06d f673f4ef81709a77 296e8c72b04be4b6 76577d31480fe748 13226bfe624a2422 fadbd8096d2d13e4 da90e0e9226c4fd8 5946c7ba903c8b00 394390cdb0fe3d82 95985cf706196004 a592337ed7d86082 75b70d310f847dad 5413e33203e06ef8 63e64e39cf8fccd1 29a583b05f10d130 711807594952aea6 adfba6623a030b62 b5f096693c73477b with fingerprint ssh-rsa 2048 ab:f9:58:8e:1e:61:21:2b:c2:f7:38:de:7a:bf:ea:ce
. 2017-03-27 14:15:01.248 Host key matches configured key
. 2017-03-27 14:15:01.248 Initialised AES-256 SDCTR client->server encryption
. 2017-03-27 14:15:01.248 Initialised HMAC-SHA1 client->server MAC algorithm
. 2017-03-27 14:15:01.248 Initialised AES-256 SDCTR server->client encryption
. 2017-03-27 14:15:01.248 Initialised HMAC-SHA1 server->client MAC algorithm
. 2017-03-27 14:15:01.314 Reading key file "C:\doaprivatekey.pkk"
. 2017-03-27 14:15:01.314 Unable to use this key file (unable to open file)
! 2017-03-27 14:15:01.314 Unable to use key file "C:\doaprivatekey.pkk" (unable to open file)
! 2017-03-27 14:15:01.315 Using username "npcs".
. 2017-03-27 14:15:01.324 Server offered these authentication methods: publickey
. 2017-03-27 14:15:01.324 Disconnected: No supported authentication methods available (server sent: publickey)