sshnet / sshnet/SSH.NET

`SftpClient` hangs on `Connect/ConnectAsync` to `atmoz/sftp` server

Open
#1,732 9 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

Happened on Fedora 42 (did not test on other OSs if matters), when I spin up atmoz/sftp docker image, and try to connect to it.

Connecting via Linux sftp -P <port> <user>:localhost to the same docker works perfectly fine.

In the atmoz/sftp logs, I see that the client actually authenticates:

[/entrypoint] Executing sshd
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
Accepted password for testuser from 172.17.0.1 port 50554 ssh2

However, it will not release Connect/ConnectAsync afterwards.

Configuring timeout in ConnectionInfo or for CancelationTokenSource, has not effect.

Using same SftpClient to connect to another locally spined SFTP, but using SFTP Go server, works fine.

Tried this with multiple SSH.NET versions, from latest back to mid 2024, same behavior.

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

Reproduce the hang with the atmoz/sftp Docker image, then compare SSH.NET's Connect and ConnectAsync behavior with the working Linux sftp client and SFTP Go server. Start by tracing the connection flow after password authentication and verify that both methods return normally and that the configured timeout or cancellation behaves as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.