Skip to content

Keypairs (SSH keys)

A keypair is basically a ssh key allowing you to login to your Linux instance

Info

Keypairs have to be created before instances creation, and associated during the instance creation process.

Using your existing SSH key

Assuming your existing ssh public key is located at ~/.ssh/ssh_my_rsa_key.pub

Import it using the following command:

taylor@laptop:~$ openstack keypair create --public-key ~/.ssh/ssh_my_rsa_key.pub my_keypair
+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| fingerprint | 53:c0:03:5f:27:6f:c2:66:b4:e4:f3:26:e0:f8:82:4a |
| name        | my_keypair                                      |
| user_id     | b1580497f51e4d10b9110c60c154562c                |
+-------------+-------------------------------------------------+

Keypair1

  • Name your keypair and import your public key

Keypair2

$ ssh -i ~/.ssh/ ~/.ssh/ssh_my_rsa_key *adminuser*@my-instance-name

Using a new keypair

A new keypair can also be created for use, such as with a dedicated service account or daemon.

$ openstack keypair create my_keypair > ~/.ssh/my_keypair
$ chmod 600 ~/.ssh/my_keypair

The private key is saved to ~/.ssh/robotkey and can then be used for instance creation (using the --key-pair argument on the command line) and for ssh using

Keypair2

  • Name your keypair and click on Create Key Pair

Keypair4

  • Your keypair has been downloaded
$ ssh -i ~/.ssh/my_keypair *adminuser*@my-instance-name