1

The scenario here is that I received a private key generated by AWS - an ED25519 key - and tried it using Windows 10/1809's built-in ssh (OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5), and it works fine.

I tried the same key on the same PC but from within WSL Ubuntu 18.04.3 (OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017), and it complains that the key is an invalid format.

Invoking ssh -v shows:

....snip a bit here....
debug1: Authenticating to xxxxxxxx.demo.com:22 as 'jgauthier'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:fCykR67cJynMNYYYv9jEO5PhYQgcaU0WRy/xmSsTxYQ
debug1: Host 'xxxxxxxx.demo.com' is known and matches the ECDSA host key.
debug1: Found key in /home/jgauthier/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
------------------------------------------------------------------------------
                                    NOTICE
This IT system is provided for business use in accordance with approved
Policies and Procedures. By logging in, users acknowledge their understanding
that authorized administrators monitors and stores all activity generated on
this system as appropriate for business and security operations and may
disclose such activity or information as permitted by law.

------------------------------------------------------------------------------
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: jgauthier_key.pem
Load key "jgauthier_key.pem": invalid format
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

Here's the last few relevant lines from the one that works:

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: jgauthier_key.pem
debug1: Authentication succeeded (publickey).
Authenticated to xxxxxxx.demo.com ([nn.nn.nn.nn]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: console supports the ansi parsing
debug1: client_input_global_request: rtype [email protected] want_reply 0
Last login: Fri Oct 18 21:30:10 2019 from mm.mm.mm.mm
Last login: Fri Oct 18 21:30:10 2019 from mm.mm.mm.mm
[jgauthier@xxxxxxx ~]$

Any ideas? I haven't tried it yet from within a VirtualBox VM running Ubuntu 18.04.3 on the same PC, nor from another Linux system...

The host I'm connecting to is CentOS 7.6. It's server reports

Remote protocol version 2.0, remote software version OpenSSH_7.4

when I connect, if that matters.

I thought it could be CR/LF vs LF, but in WSL Linux I hand-edited the .pem file to remove any possible CR/LFs, and made sure to leave a single LF after the last line of the file - but no go. I even did a diff between the copy in my Windows .ssh directory and the copy in my WSL ~/.ssh, and they're identical.

It's something about the two versions of ssh - LibreSSL 2.6.5 vs OpenSSL 1.0.2n?

2
  • Try to run ssh command as ssh -2. The -2 option forces ssh to use protocol version 2.
    – Biswapriyo
    Oct 19, 2019 at 17:32
  • Tried that - no change... I also tried to compare /etc/ssh/ssh_config in WSL and the Windows version, which is supposed to be at %PROGRAMDATA%\ssh\ssh_config, but the directory and config files don't exist. Where else would Windows place the default config information for ssh and sshd?
    – JonG
    Oct 21, 2019 at 14:38

0

You must log in to answer this question.

Browse other questions tagged .