question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OSError: No such private key file when using OPENSSH PRIVATE KEY

See original GitHub issue

So this took a few hours for me to figure out, and wanted to post the solution online.

Basically paramiko doesn’t support openssh private key format before version 2.7.

Solution A: Ensure paramiko is at least version 2.7 pip3 install paramiko --upgrade

Solution B: Convert your private key to PEM format (usable by paramiko <=2.6) ssh-keygen -p -m PEM -f ./your_private_key

You’re welcome.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gnatcommented, Mar 19, 2021

Great. Thanks @Fizzadar

1reaction
Fizzadarcommented, Mar 19, 2021

Implemented the warning in https://github.com/Fizzadar/pyinfra/commit/6347e352a3b6ed0dc038e50c9ded52af75ae8b40 (and fixed the general not found vs. invalid key error message), released in 1.3.9 just now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mac OS , Error when generating an SSH key with Git: “no such ...
Generating public/private rsa key pair. Enter file in which to save the key (/home/hp/.ssh/id_rsa): "Press Enter on your Keyboard" (note ...
Read more >
Not using private key file - Adobe Support Community
According to the log file, my server is running OpenSSH 7.4 and my local OpenSSH is version 8.8. Bug Unresolved. TOPICS. Other ...
Read more >
Mac OS , Error when generating an SSH key with Git - iTecNote
Git – Mac OS , Error when generating an SSH key with Git: “no such file”. gitmacosssh. I want to work with GitHub...
Read more >
Set up SSH public key authentication to connect to a remote ...
Using SSH public key authentication to connect to a remote system is a robust, more secure alternative to logging in with an account ......
Read more >
SSH Suddenly returning Invalid format - Server Fault
Even if it's not the private key you need, the ssh agent won't return invalid format if the key is working, you simply...
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