PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.36k stars 757 forks source link

invalid format err for ed25519 key, need to add a newline at the end of the key make to win ssh work with it #2239

Open jiangying000 opened 3 months ago

jiangying000 commented 3 months ago

Prerequisites

Steps to reproduce

PS C:\Users\jy> C:\Users\jy\scoop\apps\openssh\current\ssh -V OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

PS C:\Users\jy> C:\Users\jy\scoop\apps\openssh\current\ssh -i ./gcp-ed25519 abc@35.xxx.yyy.140 Load key "./gcp-ed25519": invalid format abc@35.xxx.yyy.140: Permission denied (publickey).

I can connect to server with this key file in wsl ssh and xshell 7, but not windows ssh

add a newline at the end of the key make win ssh accept this file, but why? (see also: https://stackoverflow.com/a/68593742)

Expected behavior

connect success

Actual behavior

PS C:\Users\jy> C:\Users\jy\scoop\apps\openssh\current\ssh  -i ./gcp-ed25519 abc@35.xxx.yyy.140
Load key "./gcp-ed25519": invalid format
abc@35.xxx.yyy.140: Permission denied (publickey).

Error details

None

Environment data

PS C:\Users\jy> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

9.5

Visuals

No response