Sftp.Login returns Authentication method not supported.

0 votes
asked Mar 19, 2013 by Ron Shah (140 points)
edited Mar 20, 2013

Hi,

We just purchased the Sftp library for .NET and are getting the below exception when calling the Login method of the Rebex Sftp object. The same client code was successful when using the demo version of the Rebex Sftp library.

Our code (VB.NET) looks like this:

Code:

Dim client as Sftp = New Sftp
client.Connect(server, port)
client.Login(userName, password)

Exception:

Rebex.Net.SftpException: Authentication method not supported. Supported methods: 'publickey'. ---> Rebex.Net.SshException: Authentication method not supported. Supported methods: 'publickey'.
   at Rebex.Net.SshSession.VXRf6(String , String , Boolean )
   at Rebex.Net.SshSession.1QmUCN(String , String , SshPrivateKey , SshGssApiCredentials )
   at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey)
   at Rebex.Net.Sftp.1J4sBU.2AnnF7(String , String , SshPrivateKey , ZD5WJ )
   at Rebex.Net.Sftp.21klJqZ(String , String , SshPrivateKey , ZD5WJ )
   --- End of inner exception stack trace ---
   at Rebex.Net.Sftp.21klJqZ(String , String , SshPrivateKey , ZD5WJ )
   at Rebex.Net.Sftp.Login(String userName, String password)
Your assistance much appreciated, Ron

Applies to: Rebex SFTP

1 Answer

0 votes
answered Mar 20, 2013 by Tomas Knopp (58,890 points)
edited Mar 20, 2013

Hello,

it looks like the server only supports public key authentication. Please look at SFTP public key authentication tutorial.

Basically you need to do following to be able to authenticate:

' create client and connect
Dim client As New Sftp
client.Connect(hostname)

' load the private key which is used to authenticate
Dim privateKey As New SshPrivateKey("key_rsa.pem", "password")
' authenticate with the privateKey.
client.Login(username, privateKey)

' ...

How to generate private and a corresponding public key and how to make it work with the SFTP server is described in this tutorial.

commented Mar 20, 2013 by ITM8815 (100 points)
edited Mar 20, 2013

Yes, but why was the same code working in the demo version of the Rebex SFTP? We were accessing the same SFTP server without loading any keys.

commented Mar 20, 2013 by Tomas Knopp (58,890 points)
edited Mar 20, 2013

Ok, please make sure that you are using the same version of both the trial and full Rebex SFTP. If the problem still persists, please send us logs from both the full and trial version. Log can be created as described at http://www.rebex.net/kb/logging/default.aspx

commented Mar 20, 2013 by Tomas Knopp (58,890 points)
edited Mar 20, 2013

You can send the logs to support@rebex.net or post it here.

commented Mar 20, 2013 by ITM8815 (100 points)
edited Mar 20, 2013

How do we determine the two versions? We downloaded the demo copy a few weeks ago and purchased the full version 2 days ago.

commented Mar 20, 2013 by Tomas Knopp (58,890 points)
edited Mar 20, 2013

In Visual Studio right click on any of the Rebex assembly, go to Properties and the last info below is the Version ( e.g. "2.0.4700.0"), where '4700' is the build number. Here is a screenshot.

...