Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

gboudrea's avatar
gboudrea
Occasional Contributor
3 years ago

How to export SSH private key using CLI?

So I now store my SSH private keys in 1Password.
One problem I have with that is that some clients really need the private key files on disk to work (Sequel-Ace, to name one).
So I thought I could create a simple command-line script that would use op to export my SSH private key to a file, and then delete that file a few seconds later, allowing those "legacy" clients to connect using my private key.

But I just can't find how to use op to export my private key as an OpenSSH private key.
If I download the key from the 1Password 8 client, I get a text file that starts with -----BEGIN OPENSSH PRIVATE KEY-----
But if I use the CLI like this : op read op://Personal/id_ed25519/'private key', I instead get a key that starts with -----BEGIN PRIVATE KEY-----

So, how can I export an OpenSSH private key using CLI?

Or is there another way to export my SSH keys to disk?

Thanks


1Password Version: CLI 2.0.0
Extension Version: N/A
OS Version: macOS 12.3