darkoperator / darkoperator/Posh-SSH

New-SSHSession issues with RSA Key Connection

Open
#534 3 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

Script

Import-Module -Name Posh-SSH

$computer = ""
$Credentials = Get-Credential
$privateKeyPath = "C:\Users<PATH>.ssh\id_rsa"
$session = New-SSHSession -Port 22 -ComputerName $computer -KeyFile $privateKeyPath -Credential $Credentials -Verbose
if ($session.Connected -ne "True"){
Write-Output "Trouble connecting to Linux Jump Box. Script cannot be run. Please try again."
$session | Remove-SSHSession
exit
}
return $session

Invoke-SSHCommand $session -Command "ls ~"

Error Received

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
VERBOSE: Fingerprint for : <RSA_KEY Redacted>

Server SSH Fingerprint
Do you want to trust the fingerprint <RSA_KEY Redacted>
[] Y [] N [?] Help (default is "N"): Y
New-SSHSession : Session operation has timed out
At C:\Users<PATH>/test_connect.ps1:6 char:12

  • $session = New-SSHSession -Port 22 -ComputerName $computer -KeyFile $ ...
  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationTimeout: (Renci.SshNet.SshClient:SshClient) [New-SSHSession], SshOperationTimeoutException
    • FullyQualifiedErrorId : SSH.NewSshSession

Trouble connecting to Linux Jump Box. Script cannot be run. Please try again.

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 test_connect.ps1 with New-SSHSession, the RSA -KeyFile, and the supplied -Credential, then inspect the session-creation path that reports SshOperationTimeoutException. Compare the RSA-key connection behavior with the shown fingerprint and timeout output; done means the session connects successfully and Invoke-SSHCommand can run ls ~ without timing out.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.