Skip to main content

What is an SSH key?

SSH key — a pair of cryptographic keys (private and public),
used for secure passwordless access to servers.
  • Public key is added to your account and later attached to an instance.
  • Private key is stored by the user and used for authentication.
Benefits: security, no passwords, and convenient automation.
Never share your private SSH key. It is as sensitive as the 3 digits on the back of your bank card.

Create your first SSH key

  • Linux & MacOS
  • Windows
  1. Generate a key pair:
    ssh-keygen
    
  2. Enter the file names for the keys or press Enter to keep the default. For extra security, protect the key with a passphrase by entering it twice. If set, you will need to enter it each time you use the key; press Enter twice to skip.
    Enter file in which to save the key (/root/.ssh/id_rsa): <File name>
    Enter passphrase (empty for no passphrase): <Passphrase>
    Enter same passphrase again: <Passphrase again>
    
  3. A confirmation will appear. The private key stays on your device and must not be shared, while the public key is copied to the server you plan to access.
    Your identification has been saved in /root/.ssh/id_rsa
    Your public key has been saved in /root/.ssh/id_rsa.pub
    
  4. To read the file, run
    cat /root/.ssh/id_rsa.pub
    
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCmXqZCmeE9C3y3Wv1BT60UkV7BaOFWAh1HKT1jK2
    JukwT86yBe5UTrLnNXWyoNBT9810GKAdcdmsmyuP0SfyJU0IUIDmWnz0fnfefwM8Obp4/Ad2FEvGJT
    AviUnb+gQYPORwi612cFq7lWSMOswbuQ6sjlMsmysoO82CR0a2rhLZqZ7a9vpQsmWo/su6nCPMw/Tj
    lxDOw8qd8ip59pwDdszELMn+PicL3Vh8x7x1YOt/6nZzi4kWQYdPuE/mVqCg92P5+aXtI6dne2p76a
    ENSUI2Ys7XlUKSdUBZb4Zb7aBX6gpMspsIJcFY27n77Z02CSZpydBkO4pvBxauMGHVz9WHBxALdeic
    0THQaFNLMYB1/vWQ4k7LDEITVgmHGk5xpt70AS0raqOdm7dMwQLC5ixF1kiHQkDO45IO4WKOx/Pq9f
    D4L+QXAsqocQDm7RvN9FWLcWgnXebwpTGqE7z0iGSKvM5mai5JHl3TjsOERtJ3YYU/UkOl3yZXWmyB
    IDnF0= root@4537055-kh03270
    
    This line starting with ssh-rsa is your public key. Copy it and paste it when creating an SSH key. Go to the SSH keys page and click Add new SSH key.
I