darkoperator / darkoperator/Posh-SSH

New-SSHSession "A connection attempt failed ..."

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

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Hello,

I've been experienced some issues with using the command New-SSHSession to connect to hosts in the other side of the world. Pings to the host are 160-180ms which confirms longer connection time.

Using the following command gives the following error;
New-SSHSession -ComputerName ### -Port 22 -AcceptKey:$true

New-SSHSession : Connection failed to establish within 10000 milliseconds.
At line:1 char:1
+ New-SSHSession -ComputerName ### -Port 22 -AcceptKey:$true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationTimeout: (Renci.SshNet.SshClient:SshClient) [New-SSHSession], SshOperationTimeoutException
    + FullyQualifiedErrorId : SSH.NewSshSession

Using following command gives the following error;
New-SSHSession -ComputerName ### -Port 22 -AcceptKey:$true -ConnectionTimeout 100 -KeepAliveInterval 100 -OperationTimeout 100

New-SSHSession : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has fa
iled to respond
At line:1 char:1
+ New-SSHSession -ComputerName ### -Port 22 -AcceptKey:$true -Connection ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Renci.SshNet.SshClient:SshClient) [New-SSHSession], SocketException
    + FullyQualifiedErrorId : SSH.NewSshSession

(Credential parameter removed for testing purposes)

Testet with PuTTY, working fine.

Any idea what is causing this?

$PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1     

Contributor guide

No contributing guide indexed for this repository

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 by reproducing New-SSHSession with the issue's two command variants against a host with comparable latency, then compare the result with PuTTY. Investigate the reported connection and operation timeout errors and determine a specific cause or reproducible fix; the issue is complete when the command succeeds or the documented limitation is explained.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.