Skip to content

SSH Keys

OpenSSH key pairs provide access to servers via SSH.

SSH Key Ownership

SSH keys apply to the individual user. Unlike other resources, a user can see their own SSH keys. If you plan to deploy SSH keys during server creation, consider using cloud init user data. Cloud init user data is available in the extras section during server creation.

SSH Key Region

SSH keys are valid within the region where you created them. If you plan to use the same key across regions, create a copy of the key in each region.

Listing SSH Keys

Image title To get a list of all ssh-keys in a region you can click on the SSH Keys icon in the sidebar.

List SSH Keys The list of SSH Keys allows

  • Creating a new SSH Key by clicking Create on the top right
  • Quickly copying the public key by clicking the icon
  • Deleting an SSH Key using the icon
  • Navigating to the details page by clicking on the name

Configure CLI

Usage

openstack keypair list

Creating an SSH Key

You can create SSH keys by either importing an existing SSH key, for example from your own computer, or by generating one on the server.

Generate an SSH Key

Generate SSH Key Generating an SSH Key pair is easy.

  1. Choose a region in which the key should be available. Ber 1
  2. Provide a name for the key to be generated.
  3. Verify you are generating the key for the correct region.
  4. Click Create

Generate SSH Key

  1. The generated key will then be presented to give you an opportunity to save the private key to your computer. You can either copy the contents or simply download it

Don't forget to save your private key.

Make sure you really secure the private key in this step as you will not have another opportunity to do so later. The private key will be presented ONLY ONCE for security reasons.

  1. Click close once you have secured the private key

Configure CLI

Usage

openstack keypair create <name>
<name>
Name of the keypair

Import an SSH Key

Generate SSH Key To import an existing SSH Key

  1. Name the key you are importing
  2. Verify you are generating the key for the correct region.
  3. Provide the public key by

    • either using the Import Public Key option and selecting the file
    • or copy-pasting the contents of the file
  4. Click Create

Configure CLI

Usage

openstack keypair create --public-key <file> <name>
<name>
Name for the imported public key
<file>
Path to the public key file you want to import

OpenStack Terraform Provider

Example

# Terraform Provider configuration

terraform {
  required_providers {
    openstack = {
      source  = "terraform-provider-openstack/openstack"
    }
  }
}

# Import SSH Public Key

resource "openstack_compute_keypair_v2" "ssh_key" {
  name       = "ssh-public-key"
  public_key = "/home/user/.ssh/.id_rsa.pub"
}

Inspecting an SSH Key

Inspect SSH Key

  • You can copy the public key using the copy option
  • Lists the servers that were deployed using the ssh key. You can also perform a variety of server actions from the list by clicking

Configure CLI

Usage

openstack keypair show <name>
<name>
Name of the keypair to show

Deleting an SSH Key

Does not revoke SSH Keys

Deleting an SSH key removes it for future server creation. The key remains active on existing servers.

Delete SSH Key To delete an ssh key you can

  • Use the in the list of SSH Keys and select the DELETE option
  • or you can select Delete on the top right of the details page.

Confirm the deletion by clicking Delete in confirmation dialog.

Configure CLI

Usage

openstack keypair delete <name>
<name>
Name of the keypair you want to delete.
Also takes a list of names to perform a bulk delete