Skip to content

Create a keypair

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

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 mykeypair
+-------------+-------------------------------------------------+
| Field       | Value                                           |
+-------------+-------------------------------------------------+
| fingerprint | 53:c0:03:5f:27:6f:c2:66:b4:e4:f3:26:e0:f8:82:4a |
| name        | mykeypair                                       |
| user_id     | b1580497f51e4d10b9110c60c154562c                |
+-------------+-------------------------------------------------+

$ ssh -i ~/.ssh/ ~/.ssh/ssh_my_rsa_key *adminuser*@my-vm-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 robotkey > ~/.ssh/robotkey
$ chmod 600 ~/.ssh/robotkey

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

$ ssh -i ~/.ssh/robotkey *adminuser*@my-vm-name
Back to top