Cannot parse privateKey: Unsupported key format

See original GitHub issue

Mup version (mup --version): 1.4.5

Okay so the problem is, that macOS Mojave is creating new OpenSSH keys, which can’t be parsed with the ssh2 module. I googled a lot but I can’t get it to work. 😦

The older keys started with

-----BEGIN RSA PRIVATE KEY-----

the newer ones with

-----BEGIN OPENSSH PRIVATE KEY-----

Anyone found a way to fix this?

Output of command

Error: Cannot parse privateKey: Unsupported key format
    at Client.connect (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/ssh2/lib/client.js:156:13)
    at SSH.connect (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/ssh.js:12:16)
    at Session._withSshClient (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/session.js:58:12)
    at Session.copy (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/session.js:94:10)
    at doCopy (/usr/local/lib/node_modules/mup/lib/nodemiral.js:22:13)
    at Object.copy (/usr/local/lib/node_modules/mup/lib/nodemiral.js:50:3)
    at runTask (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/taskList.js:98:43)
    at TaskList._runTaskQueue (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/taskList.js:89:3)
    at iterator (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/taskList.js:55:10)
    at /usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/async/lib/async.js:249:17
    at iterate (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/async/lib/async.js:149:13)
    at async.eachSeries (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/async/lib/async.js:165:9)
    at _asyncMap (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/async/lib/async.js:248:13)
    at Object.mapSeries (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/async/lib/async.js:231:23)
    at TaskList.run (/usr/local/lib/node_modules/mup/node_modules/nodemiral/lib/taskList.js:49:11)
    at /usr/local/lib/node_modules/mup/lib/utils.js:88:10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
kevin-foster-ukcommented, Jul 11, 2019

You can change the type of private key without needing to modify your public key:

ssh-keygen -m PEM -p -f ~/.ssh/id_rsa

2reactions
charlesdagenaiscommented, Dec 7, 2018

@Twisterking See here Try to generate your key pair with ssh-keygen -m PEM -t rsa

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Cannot parse privateKey: Unsupported key format
I validated the key with ssh command, it just works fine. But not with the node. js module SSH2. In the private key...
Read more >
Cannot parse privateKey: Unsupported key format #85 - GitHub
Error while connecting to SSH FS my_prg: Cannot parse privateKey: Unsupported key format I am on macbook pro, the key is a regular...
Read more >
Verify the SSH service connection details. Error
Verify the SSH service connection details. Error: Error: Cannot parse privateKey: Unsupported key format.
Read more >
How could I connect by ssh node to my server? - n8n community
I tried to connect by “ssh node” to my google compute with private key, but it failed by this error: ERROR: Cannot parse...
Read more >
SSH Public key authentication "Cannt parse private key ...
Hello Guys, I'm trying to set up a public key authentication on some cisco devices. ... "Cannt parse private key : Unsupported key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found