Update: Support for this variant of interactive password prompt has been added to Rebex SFTP 2016 R2.
Hi, the most likely cause is a configuration change at the server. Based on the exception, I guess that either the server switched to keyboard-interactive
authentication, or its password prompt changed to include the "PASSWORD" word in uppercase, which is not detected and handled by Rebex SFTP client (unlike "password" in lowercase).
To determine why the observed behavior is different on DEV box and PROD box, please create communication logs (one at DEV, another at PROD) using Sftp
object's LogWriter property and compare them (you can post them here or mail them to support@rebex.net for analysis).
The error itself indicates that the server requested a variant of keyboard-interactive
authentication that the client was unable to answer without user interaction, most likely because of the upper-case "PASSWORD" prompt. If the "password" was lowercase, it would be detected as password prompt and answered automatically.
Solution
We will add support for uppercase "PASSWORD" prompts to the next release.
To fix the issue with your current release, register an AuthenticationRequest
event handler that can answer this particular password prompt:
Rebex.Net.Sftp client = new Rebex.Net.Sftp();
client.Connect("myserver.domain.com");
// register authentication request event handler to answer the password prompt
client.AuthenticationRequest += (sender, e) =>
{
if (e.Instructions == "Enter your PASSWORD:" && e.Items.Count == 1 && e.Items[0].IsSecret)
{
e.Items[0].Response = password;
}
};
client.Login(user, password);
MessageBox.Show(user + " is able to connect");
client.ChangeDirectory("DestinationpathofFTPserver");
client.PutFile(SourePath, "Filename.text");
client.Disconnect();