Topic "Unable to connect with SFTP using 5.0.7 beta...."

Author Message
[View user's profile]

Joined: 2012-06-29
Posts: 2
Location: United States
First off, I'm new to WinSCP, I've only been working with it 2 days but have digested a lot of information that has been helpful but am now stuck.

I have developed a VB.NET Windows Service running under XP. I need to transfer files to a secured FTP site so have downloaded your VB.NET Assembly. I initially downloaded 4.3.8 of WinSCP but when I first attempted to connect with the VB.NET it told me the versions did not match so I downloaded and installed 5.0.7 of WinSCP. I'm able to connect to my server with the GUI and transfer files. Each time I connect I get a warning about connecting to the server but then it connects and I can transfer files. From VB.NET I get the message "Connection has been unexpectedly closed. Server sent command exit status 0.". I viewed your error list but nothing seemed to help.

Next I produced a log using Session.SessionLogPath and it appears that it's expecting a Password? Why when I've provided it with a Host Key? I've used the GUI so I know the username is correct and connected leaving the password blank. I'll post my code first (with security info removed) and then the log.

Thanks in advance.

Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Sftp
.HostName = SFTPServerName
.UserName = Username
.Password = ""
.SshHostKey = SFTPServerKey
End With

Using session As Session = New Session
' Connect
session.SessionLogPath = OutputFolder & "WinSCP.log"

' Upload files
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary

Dim transferResult As TransferOperationResult

transferResult = session.PutFiles(FileToBeSent, SFTPServerDir, False, transferOptions)

' Throw on any error

' Print results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
bErr = util.SaveTextToFile(Now().ToString & " Transferred: " & FileToBeSent & ".", OutputFolder & "Transactions.log", ErrInfo)
End Using

. 2012-06-28 19:40:42.953 Looking up host ""
. 2012-06-28 19:40:42.953 Connecting to 99.999.999.999 port 22
. 2012-06-28 19:40:43.046 Server version: SSH-2.0-1.36 sshlib: GlobalScape
. 2012-06-28 19:40:43.046 We believe remote version ignores SSH-2 maximum packet size
. 2012-06-28 19:40:43.046 Using SSH protocol version 2
. 2012-06-28 19:40:43.046 We claim version: SSH-2.0-WinSCP_release_5.0.7
. 2012-06-28 19:40:43.093 Using Diffie-Hellman with standard group "group1"
. 2012-06-28 19:40:43.093 Doing Diffie-Hellman key exchange with hash SHA-1
. 2012-06-28 19:40:43.421 Verifying host key dss 0xb92c47e49b8df5f80c1740a0c38021eb1cead9b982...
. 2012-06-28 19:40:43.421 Host key matches configured key
. 2012-06-28 19:40:43.421 Host key fingerprint is:
. 2012-06-28 19:40:43.421 ssh-dss 1024 86:08:93:00:55:be:b5:0c:3c:92:97:85:3f:f4:09:46
. 2012-06-28 19:40:43.421 Initialised Blowfish-128 CBC client->server encryption
. 2012-06-28 19:40:43.421 Initialised HMAC-SHA1 client->server MAC algorithm
. 2012-06-28 19:40:43.421 Initialised Blowfish-128 CBC server->client encryption
. 2012-06-28 19:40:43.421 Initialised HMAC-SHA1 server->client MAC algorithm
! 2012-06-28 19:40:43.671 Using username "".
. 2012-06-28 19:40:43.718 Prompt (7, SSH password, , &Password: )
. 2012-06-28 19:40:43.718 Disconnected: Unable to authenticate
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
Maybe you are confuing a host key fingerpring with a private key path. Hostkey is not used for authentication.
Martin Prikryl
[View user's profile]

Joined: 2012-06-29
Posts: 2
Location: United States
Thanks for the advice. I added the SshPrivateKey property and it's now transferring data.

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License