Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SSH KeyFilePath parameter not working  #4475

Copy link
Copy link
@luzlab

Description

@luzlab
Issue body actions

When I try running New-PSSession or Enter-PSSession using a public key, powershell either:

  1. When passed a valid KeyFilePath, complains that it doesn't exist and continues gracefully to password-based authentication.
  2. When passed a bogus KeyFilePath, throws an ItemNotFoundException

Steps to reproduce

> New-PSSession -UserName "xx" -KeyFilePath "/fakepath" -Hostname " xx.xx.xx.xx"
New-PSSession : Cannot find path 'doesntexist' because it does not exist.
At line:1 char:1
+ New-PSSession -UserName "Administrator" -KeyFilePath "doesntexist" -H ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (doesntexist:String) [New-PSSession], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.NewPSSessionCommand

> New-PSSession -UserName "xx" -KeyFilePath "~/.ssh/id_rsa" -Hostname " xx.xx.xx.xx"
Warning: Identity file "/Users/cquinonez/.ssh/workgangkey" not accessible: No such file or directory.

Expected behavior

>  New-PSSession -UserName "xx" -KeyFilePath "/fakepath" -Hostname " xx.xx.xx.xx"
Warning: Identity file "/Users/cquinonez/.ssh/workgangkey" not accessible: No such file or directory.
>  New-PSSession -UserName "xx" -KeyFilePath "<validKeyFilePath>" -Hostname " xx.xx.xx.xx"

 Id Name            ComputerName    ComputerType    State         ConfigurationName     Availability
 -- ----            ------------    ------------    -----         -----------------     ------------
  1 SSH1            xx.xx.xx.xx     RemoteMachine   Opened        DefaultShell             Available

Actual behavior

untitled

I've verified that Test-Path also correctly detects the key file as well.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.4
OS                             Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.Size-DaysWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.