-
-
Notifications
You must be signed in to change notification settings - Fork 959
Open
Description
I'm trying to connect to a server thru SSH.NET. It worked fine before but started to show "An established connection was aborted by the server" after some FW update on the server. Below is the code I'm using
private void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
{
foreach (AuthenticationPrompt prompt in e.Prompts)
{
if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
{
prompt.Response = "password";
}
}
}
private void sshConnectBut_Click(object sender, EventArgs e)
{
var auth1 = new PasswordAuthenticationMethod("username", "password");
var auth2 = new KeyboardInteractiveAuthenticationMethod("username");
auth2.AuthenticationPrompt += new EventHandler<AuthenticationPromptEventArgs>(HandleKeyEvent);
ConnectionInfo conInfo = new ConnectionInfo("Host", 22, "username", auth1, auth2);
this.sshClient = new SshClient(conInfo);
this.sshClient.ConnectionInfo.Timeout = TimeSpan.FromSeconds(120);
this.sshClient.Connect(); **<---- Error happened here**
}
Can anyone help me on this issue please?
Metadata
Metadata
Assignees
Labels
No labels