0 votes
by (140 points)

I am able to login to SFTP server through WINSCP client but not able to do programmatically using rebex .net libraries.

I used the sample code shared on your portal ,copying again below.

Its throwing authentication error after providing password itself which is otherwise going through WinScp Client.

Error from logs:

ERROR Sftp(1)[1] SSH: Rebex.Net.SshException: Supplied credentials not accepted by the server

var sftp = new Sftp();
sftp.Connect(hostname);

// register AuthenticationRequest event handler
sftp.AuthenticationRequest += client_AuthenticationRequest;

// log in (alternatively, omit username and password as well)
sftp.Login(username, password);

void client_AuthenticationRequest(object sender, SshAuthenticationRequestEventArgs e)
{
Console.WriteLine("Server: {0}", e.Name);
Console.WriteLine("Instructions: {0}", e.Instructions);

foreach (SshAuthenticationRequestItem item in e.Items)
{
    // display question
    Console.Write(item.Prompt);

    // set answer
    item.Response = Console.ReadLine();
}

}

Applies to: Rebex SFTP

1 Answer

0 votes
by (147k points)

The most common reason for the "Supplied credentials not accepted by the server" error is that the supplied user name or password is wrong. Please double-check once more that you are in fact connecting to the same server, same port, and using the same user name and password in Rebex SFTP and in WinSCP.

Once you make sure all of that is really the same, but the issue persists, try connecting and authenticating to the same server using a third SFTP client - PuTTY's psftp.exe command-like client is ideal for this purpose. Based on the outcome of this test, we would be able to provide further instructions to determine what's going on.

...