What is an SSH key?

An SSH key lets you log in to a Linux server without typing its password. It has two parts. The private key stays on your computer, and you should never send it to anyone. The public key is placed on the server, and it is safe to share it.

You can save your public keys in your account once and then just select them when you order a server or install an operating system.

How to create a key

If you already have a key, skip this step. If not, open a terminal (on Windows, open PowerShell) and run this command:

ssh-keygen -t ed25519 -C "alex@laptop"

Instead of alex@laptop you can enter any comment. It helps you tell your keys apart, and we will also use it as the name of the key. You will be asked where to save the key, and you can just press Enter. If there is already a key with this name, do not overwrite it, choose another name. You can also set a passphrase for the key, so nobody can use it without this passphrase, even if they get the file.

Then display the public key. If you saved it under another name, use that name in the command:

  • Linux and macOS: cat ~/.ssh/id_ed25519.pub
  • Windows: type $env:USERPROFILE\.ssh\id_ed25519.pub

Copy the whole line. Make sure that the file name ends in .pub, as the file without it is your private key.

How to add a key

Keys are added in the settings of the operating system. You will find them in the installation window and at the operating system step of a new order.

Please note: installing an operating system deletes all data on the server. Adding a key on its own doesn't start the installation, so you can close the window after you add it.

  1. Open the server dashboard and click Install in the Operating system widget.
  2. Choose a Linux system and click Next.
  3. Under Authentication, select SSH key only or Password + SSH key.
  4. Click Add SSH key and paste your public key. If the key has a comment, it will become the name, but you can change it.
  5. Click Add key. The key will be saved in your account and selected for this installation.

The form for a new SSH keyThe form for a new SSH key

You can add RSA, Ed25519 and ECDSA keys. An account can have up to 20 keys. This setting is not available for Windows.

If you are ordering your first server and don't have an account yet, you can also add a key in the order. It will be saved in your new account.

Key only or key and password

  • SSH key only: the server won't accept a password over SSH. You need to select at least one key, otherwise you won't be able to continue. The system still has a password, and you may need it for the console or a control panel.
  • Password + SSH key: you can log in both ways.

Saved keys in the installation settingsSaved keys in the installation settings

If you choose SSH key only, keep a copy of your private key in a safe place. If you lose it, you can still log in with the password in the console and add a new key there.

How to connect

When the installation is complete, run this command with the IP address of your server:

ssh root@203.0.113.10

The username is in the Operating system widget. If you have changed the SSH port in Advanced settings, add it to the command, e.g. ssh -p 2222 root@203.0.113.10. If you saved the key under another name, add the path to it: ssh -i ~/.ssh/my_key root@203.0.113.10.

If the server is already running

The selected keys are only added to the server during the installation. If you save a new key in your account, it won't appear on the servers that are already running. You don't have to reinstall the system though: log in to the server, open ~/.ssh/authorized_keys and add your public key there on a new line.

How to delete a key

In the list of keys, click the trash icon next to the key and confirm it. The key will be removed from your account, but it will stay on the servers where it was installed. If nobody should use this key anymore, for example if your laptop was stolen, also remove its line from ~/.ssh/authorized_keys on every server.