C# SSH.NET "ERROR: An established connection was aborted by the server"
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report names no repository file or test; start by reviewing the ConnectionInfo setup and the failure at sshClient.Connect(). Use the comment thread to establish whether the firewall change, authentication methods, or server-side disconnect is reproducible, then document a confirmed cause and a regression test or minimal reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100