SSH Keys¶
An SSH key lets you log in to your virtual machines without a password. It is a key pair: the public key is stored in the platform and placed on each VM you create with it, and the private key stays with you and proves who you are when you connect.
An SSH key belongs to one project and one infrastructure, and a VM can only use a key on its own infrastructure. To run VMs on several infrastructures, you need a key on each. The owner project can share a key with other projects so they don't need their own.
You manage SSH keys under COMPUTE & NETWORK > SSH Keys.
Create an SSH key¶
- Go to SSH Keys and click Create SSH Key.
- Under Where it runs, choose the project and the infrastructure. Optionally give the key a name and description.
- Under Key, choose where it comes from:
- Generate for me: the cloud generates the key pair (on OpenStack, an RSA key; the private key is in PEM format) and the console shows you the private key once.
- Use my public key: paste the public half of a key you already have, usually one line starting with
ssh-ed25519,ssh-rsaorecdsa-sha2-…(for example from~/.ssh/id_ed25519.pub). A PEM public key works too: it is converted to that one-line format. Your private key never leaves your machine.
- Click Create SSH Key.
Save a generated private key before you close the dialog
Click Copy to Clipboard, paste the key into a file on your computer (for example ~/.ssh/my-key.pem) and restrict its permissions with chmod 600 ~/.ssh/my-key.pem. The platform doesn't keep the private key and can't show it again. If you lose it, create a new key.
You can also create a key from the virtual machine wizard: click + next to the SSH key picker.
A key can't be edited after it is created. To use a different key, create a new one.
Log in to a VM with your key¶
Pick the key when you create the VM. It can't be added to or changed on a VM later. Once the VM is running:
ssh -i ~/.ssh/my-key.pem <user>@<address>
<user>depends on the VM's image, for exampleubuntufor Ubuntu images,debianfor Debian,cloud-userorcentosfor some RHEL-family images. Check the image's documentation.<address>is one of the VM's IP addresses, shown on its page. Your computer must be able to reach that address, and the VM's firewalls must allow SSH (TCP 22) from your address.- If you registered your own public key, use the matching private key (often you can leave out
-i).
Import an SSH key from your cloud¶
An OpenStack keypair can be imported as an SSH key.
- Go to SSH Keys and click Import SSH Key.
- Choose the project and the infrastructure, then the SSH key in your cloud.
- Click Import SSH Key.
SSH-key-specific behaviour:
- Always read-only. A key can't change once it exists, so there is no Managed mode.
- Take ownership works only while the keypair still exists in your cloud and was created by the same cloud user that the infrastructure connects with.
- Keys the platform created can't be imported. A keypair that the platform created for an SSH key may appear in the list, but importing it is refused. To use that key in another project, share it.
For what importing, taking ownership and detaching mean, see Imported resources.
Share an SSH key with other projects¶
Projects you share a key with can pick it when they create VMs on the same infrastructure. Because a VM's key can't be changed, you can't remove a project from the share until its VMs created with the key are deleted. See Share a resource.
Delete or detach an SSH key¶
- Delete removes the key from the platform and from your cloud. It can't be undone.
- Detach removes the key from the platform and keeps the keypair in your cloud. You can import it again later.
Both are in the key's Actions menu, and you confirm by typing the key's name. Imported keys can only be detached until your project takes ownership of them.
Both are refused while any VM uses the key, in any project. Because a VM's key can't be changed, those VMs must be deleted (or detached from the platform) first. Check Related Resources on the key's page, or use View dependencies.
A key in Error means the cloud couldn't create the keypair. It can't be used for VMs and still counts against your quota: delete it and create a new one. See Resource statuses.
Quotas¶
Each SSH key, created or imported, uses one ssh-keys unit. See Resource Quotas.
Permissions¶
| Task | Permission |
|---|---|
| Create | sshkey_create |
| Import | sshkey_import |
| Use a key when creating a VM | sshkey_attach, in the VM's project |
| Take ownership | sshkey_authority_update |
| Change sharing | sshkey_share |
| Delete / Detach | sshkey_delete / sshkey_detach |
The create and import forms also need some organization-level permissions to pick where the key lives (and, for import, to read your cloud): see What project members typically need. Full list: Permissions Reference.