I've recently downloaded and installed the trial version of the Rebex SFTP DLLs and I created a simple VB.Net application to test connecting, authenticating, and transferring files to an SFTP server.
I've based my code on a sample I found here: SFTP Tutorial
And here is my code to connect to the SFTP server:
Private Sub ConnectToSFTP()
Dim strHostname As String = "xxxxxxxx.xxxx.xxx.xxx"
Dim strUsername As String = "xxxxxxxx_xxxx_xx"
Dim strPassword As String = My.Settings.SFTPaccess
Try
oSFTP = New Sftp
oSFTP.LogWriter = New Rebex.FileLogWriter(Application.StartupPath & "\RebexSFTP_log_" & Format(Now, "yyyyMMdd") & "_" & Format(Now, "HHmmss") & ".txt", Rebex.LogLevel.Verbose)
oSFTP.Connect(strHostname, 22)
oSFTP.Login(strUsername, strPassword)
Me.lblConnected.Visible = True
Catch ex As Exception
MessageBox.Show(ex.Message & vbCrLf & vbCrLf & ex.StackTrace, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
When I run my code I get an error, "A supplied password or user name is incorrect."
I've double-checked the username and password and they are correct. I am able to connect to this SFTP server using FileZilla, WinSCP (GUI), and the Rebex Windows sample application that came with the download, all using the same username and password.
I'm not sure what I'm doing wrong. The sample code seemed so simple that maybe I'm overlooking something.
Thanks for any suggestions.
Below I have included the debug log that was generated:
2012-03-26 09:52:16.001 Opening log file.
2012-03-26 09:52:16.033 INFO Sftp(1)[9] Info: Connecting to xxxxxxxx.xxxx.xxx.xxx:22 using Sftp 3.0.4444.0 (trial version).
2012-03-26 09:52:19.272 DEBUG Sftp(1)[9] SSH: Server is 'SSH-2.0-WRQReflectionforSecureIT_7.2.1 Build 736'.
2012-03-26 09:52:19.282 INFO Sftp(1)[9] SSH: Negotiation started.
2012-03-26 09:52:19.342 DEBUG Sftp(1)[9] SSH: Group exchange.
2012-03-26 09:52:19.392 DEBUG Sftp(1)[9] SSH: Negotiating key.
2012-03-26 09:52:19.622 DEBUG Sftp(1)[9] SSH: Validating signature.
2012-03-26 09:52:19.652 INFO Sftp(1)[9] SSH: Negotiation finished.
2012-03-26 09:52:19.652 INFO Sftp(1)[9] Info: Server: SSH-2.0-WRQReflectionforSecureIT_7.2.1 Build 736
2012-03-26 09:52:19.662 INFO Sftp(1)[9] Info: Fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
2012-03-26 09:52:19.662 INFO Sftp(1)[9] Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes256-ctr/aes256-ctr, SHA1/SHA1
2012-03-26 09:52:19.732 INFO Sftp(1)[9] SSH: Received banner: WARNING WARNING WARNING This is a …
2012-03-26 09:52:19.782 DEBUG Sftp(1)[9] SSH: Allowed authentication methods: password.
2012-03-26 09:52:19.792 DEBUG Sftp(1)[9] SSH: Trying password authentication for 'xxxxxxxx_xxxx_xx'.
2012-03-26 09:52:21.863 ERROR Sftp(1)[9] SSH: Rebex.Net.SshException: A supplied password or user name is incorrect.
at Rebex.Net.SshSession.1QmUCN(String , String , SshPrivateKey , SshGssApiCredentials )