sshnet / sshnet/SSH.NET

SftpClient.Connect keeps retrying even on authentication failure

Open
#1,154 3 comments 1 reaction 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

Hello,

SftpClient.Connect() retries connection attempts even on authentication failure, should return immediately.

var connectionInfo = new ConnectionInfo("host", "username", new[]
{
	new PasswordAuthenticationMethod("username", "password")
})
{
	Timeout = TimeSpan.FromMilliseconds(5000),
	RetryAttempts = 1
};

var sftpClient = new SftpClient(connectionInfo);

sftpClient.Connect();

Retrying with the same invalid credentials sounds wrong, plus Connect() takes longer until timeout, plus might throw on either password OR connection timeout (randomly).

Thank you in advance.

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 at SftpClient.Connect() and trace how authentication failures are handled during connection attempts. Reproduce the issue with the provided invalid-credentials example, then verify that an authentication failure returns immediately without retrying or being replaced by a connection-timeout error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.