PowerShell / PowerShell/Win32-OpenSSH

UserKnownHostsFile parameter problems specifying paths with W

Open
#1,784 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Only this weird construct works:
ssh -v -o'UserKnownHostsFile="""C:\Program Files\whitespace test\known_hosts"""' -i 'C:\Program Files\whitespace test\id_ecdsa' user@ip

Nothing else worked for me so far when specifying a path with whitespaces via PowerShell.
The -i parameter on the other side is capable of processing paths with a whitespace.

More badly, when executing the above command that works in PowerShell within a PowerShell module, we get:
command-line: line 0: Bad configuration option: 'userknownhostsfile

So executing an SSH command that contains a user known hosts path with whitespace within a PS module does not work at all.

Observed on:
Windows PowerShell 5.1 (Build 19041, Revision 906)
Windows 10 Enterprise
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 (FileVersion: 7.7.2.1)

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 reported commands in Windows PowerShell 5.1, comparing UserKnownHostsFile and -i when paths contain spaces. Check the command-line parsing for the -o option and PowerShell module execution; done means a whitespace-containing known-hosts path works in both contexts without a bad configuration option error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.