Creating and Converting OpenSSH Keys

Introduction

Connecting to an SSH (Secure SHell) or SFTP (Secure File Transfer Protocol) service can be done by specifying a username and OpenSSH-compliant key, instead of username and password. This guide presents how to create an OpenSSH key or convert an existing key to the OpenSSH format.

Creating OpenSSH Keys

To create a new OpenSSH key in Linux or Windows:

  1. Run this command in a Linux terminal or Windows command prompt, substituting your email as a label:

ssh-keygen -m pem -t rsa -b 4096 -C "[email protected]"

  1. When you're prompted to enter a file for storing the key, press <Enter> to accept the default file location or specify your own.
  2. Enter and confirm a secure passphrase to add an extra layer of security to your SSH key.
  3. Verify that your SSH public and private keys have been created and ensure that you store them safely.

Converting PEM Keys to OpenSSH

If you need to convert your private and/or public key to an OpenSSH key, you can use PuTTYgen on:

  • Linux: Run these commands as the root user or via sudo:
  1. Install:

apt install putty-tools

  1. Convert PPK key to OpenSSH format:

puttygen ppk_key_id.ppk -O private-openssh -o openssh_rsa_id.key

  • Windows:
  1. Download and install PuTTY for Windows.

PuTTY Key Generator

  1. Run the PuTTYgen utility and load the key to convert. You may need to specify a passphrase to unlock the key.
  2. Set and confirm a passphrase in “Key passphrase” and “Confirm passphrase” to secure access to the generated key.

PuTTY Key Generator - Export OpenSSH Key

  1. Click “Conversions” > “Export OpenSSH key” and enter a filename to store the generated OpenSSH key file.
  2. Click on “Save”.

Last Updated

This document was last updated on 21 September 2021

https://www.3cx.com/docs/manual/convert-open-ssh-key/