A supplied password or user name is incorrect

0 votes
asked Mar 26, 2012 by JMPearson (190 points)
edited Mar 27, 2012

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 )

Applies to: Rebex SFTP

2 Answers

0 votes
answered Mar 26, 2012 by Tomas Knopp (58,890 points)
edited Mar 26, 2012
 
Best answer

Does the SftpFileList-VB sample program work with your username and password? If so, please use the SftpFileList-VB sample and create the verbose log of the communication. Try comparing the log from the sample with your verbose log. Do the logs correspond to each other?

If the sample also cannot connect, please let us know. In both cases we will investigate further.

0 votes
answered Mar 26, 2012 by JMPearson (190 points)
edited Mar 27, 2012

Comparing the logs files got me my answer. Things are working now. Thank you for your input!

commented Mar 27, 2012 by Tomas Knopp (58,890 points)
edited Mar 27, 2012

You're welcome!

commented Aug 4, 2015 by cdkshashank (100 points)
I have encountered same problem, so i added verbose log after creating Sftp object and found that the username and password which i am supplying to method "Login" does not match to what log is showing.

i have no idea from where the username and password are getting passed which is in Log.

Could you please help me on this ?

below is the Log :

2015-08-04 16:58:53.090 Opening log file.
2015-08-04 16:58:55.338 INFO Sftp(1) Info: Connecting to adpdsftp.ds.adp.com:22 using Sftp 2.0.4086.0.
2015-08-04 16:58:56.090 INFO Sftp(1) SSH: Negotiation started.
2015-08-04 16:58:56.947 INFO Sftp(1) SSH: Negotiation finished.
2015-08-04 16:58:56.947 INFO Sftp(1) Info: Server: SSH-2.0-OpenSSH_4.3
2015-08-04 16:58:56.948 INFO Sftp(1) Info: Fingerprint: 39:1e:bc:69:36:18:3c:6c:c2:3e:f7:07:09:e5:57:5f
2015-08-04 16:58:56.948 INFO Sftp(1) Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes256-cbc/aes256-cbc, SHA1/SHA1
2015-08-04 16:59:00.410 ERROR Sftp(1) SSH: Rebex.Net.SshException: A supplied password or user name is incorrect.
   at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials )
2015-08-04 16:59:00.414 ERROR Sftp(1) Info: Rebex.Net.SshException: A supplied password or user name is incorrect.
   at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials )
   at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey)
   at Rebex.Net.Sftp.Login(String userName, String password, SshPrivateKey privateKey)
commented Aug 5, 2015 by Tomas Knopp (58,890 points)
So if I understand it correctly, you are able to connect and login with our sample program, but authenticating from your program fails with the above exception? Could you please send us the Debug log from both our sample program and your program? Seeing them side by side I will be able to advice what to do in your program to make it work. Thansk!
commented Aug 5, 2015 by cdkshashank (100 points)
Tomas I solved the problem, I was using SFTP object  but the site was FTP. I changed the object to ftp object and could upload the file. Thanks anyways.
commented Aug 5, 2015 by Tomas Knopp (58,890 points)
Ok! good to hear that you have a working solution now :-)
...