sshnet / sshnet/SSH.NET

'An established connection was aborted by the server.' when passing connection info to the constructor

Open
#964 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

This is non urgent because there is a simple workaround, but I thought it might be worth reporting (at least partly because I couldn't find a solution on Google and only stumbled across this one by luck.

var targetFtpHost = "sftp.myserver.com";
var targetFtpHostUserName = "myUsername";
var targetFtpHostPassword = "myVerySecurePassword";

var connectionInfo = new ConnectionInfo(
    targetFtpHost, 
    22, 
    "sftp", 
    new PasswordAuthenticationMethod(targetFtpHostUserName, targetFtpHostPassword));

using (var sftp = new SftpClient(connectionInfo))
{
     sftp.Connect();
...

Up until Monday, this code was working to create a connection to the server. Then on Monday the server was updated and it started failing with the error 'An established connection was aborted by the server.' when Connect was called. (I think the server in question is using Globescape but I don't have access to it so unfortunately can't pass on any logs/info from there about what might have caused the problem).

When I replaced the line setting up the sftp object with
using (var sftp = new SftpClient(targetFtpHost, targetFtpHostUserName, targetFtpHostPassword))
it started working again!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SftpClient(ConnectionInfo) and host/username/password constructors, then follow their Connect paths to compare how each establishes the SFTP connection. The report provides no repository files or tests and lacks server logs, so done would require reproducing the constructor difference or identifying why the two paths behave differently against the updated server.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.