1 Answer

This error message indicates that the SFTP server requires the user to authenticate using both a password and a public key. To do this, call the Login method overload that accepts password and private key (which is needed to perform public key authentication):

That looks something went wrong. Would it be possible to create a communication log showing what's going on, and either post it here or mail it to support@rebex.net? That should give us some ideas about what might be the issue. To create the log, just specify a log writer: sftp.LogWriter = new FileLogWriter("rebex-log.txt", LogLevel.Debug);

Thanks! According to the log, it looks like the server actually accepted both the password and public key. But instead of authenticating the client, the server is asking for further public key authentication. The client fails at this point because it has already successfully authenticated using the key.

The most likely explanation for this is a server-side bug. Are you able to connect to the same account using any SFTP client application such as WinSCP or FileZilla?

Regardless, it might be useful to try reversing the order of the two authentication steps to publickey-first. To achieve this, just set the following property before connecting to the server:
sftp.Settings.TryPasswordFirst = false;

Similar behavior with WinSCP and CuteFTP indicates that this is indeed a server-side issue. At this point, possible options are rather limited:
a) Get assistance from the server vendor. This appears to be a server-side issue, so they should be able to help.
b) Upgrade the server to a more recent version. It's quite possible this will solve the issue.
c) Find an SFTP client app that is able to authenticate to this server using the same credentials. This might make it possible for us to determine what it does differently and add a workaround.

Hey Lukas..
We communicated with the client and it was confirmed that it was a thing in Server Side.. To be precise, they had to white-list the public key that we had to sent.
Thank you for your support Lukas.