0 votes
by (140 points)


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:


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


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
by (58.9k points)


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

' 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.


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.

by (58.9k points)

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

by (58.9k points)

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


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

by (58.9k points)

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.