How to create and enable SSH Keys

SSH Keys Overview

This page shows you how to create and enable SSH Keys.

Important

  • If you add a new SSH key into the console and can ssh your instance, reload your ssh-keys with scw-fetch-ssh-keys --upgrade command
  • If you add a new SSH key into the console and can not access your instance, reboot your instance from the Control Panel to load ssh-keys

Before connecting to your instances, you must set an existing public Key to your account. If you already have an SSH Key skip Step 1.

Important: For security reasons you must generate a 2048-bit or 4096-bit RSA key. Older 1024-bit keys are no longer supported.

Step 1 - Create the RSA Key Pair

  • On OSX and Linux
  • On Windows

On OSX and Linux

  • Open a terminal
  • Generate a new Key typing the following command ssh-keygen -o

The -o option was added in 2014; if this command fails for you, simply remove the -o option

  • Give a name to your Key Enter file in which to save the key (/Users/me/.ssh/id_rsa): otherwise, the default name will be id_rsa
  • Set a passphrase Enter passphrase (empty for no passphrase): this step is not mandatory but highly recommended
  • You should now have two files for your Key (a public key that we will copy on your instances, and a private key that you must keep secret), in our example the two files are located in the /Users/me/.ssh/ directory

The public Key is named id_rsa.pub The private Key is named id_rsa

The entire key generation looks like this

ssh-keygen -o

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/me/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/me/.ssh/id_rsa.
Your public key has been saved in /Users/me/.ssh/id_rsa.pub.
The key fingerprint is:
12:93:cc:c1:5b:76:4f:b6:b9:b4:65:b0:33:8b:f1:59 me@localhost
...
  • Copy your public key content which is required for step 2
cat /Users/me/.ssh/id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3TsFepMvwNBIjsr3Zr85mj/Aho/tk3220ryzVxgxR44EWz9xe8YhUt0Tg08e4pHns8DV6UnGwDeGLtxNwSFZlh1Zox3jACHL2dId04NAjLno1MsddByudPB7UpRu+nUjN7b8/rIAjXNu4k7H+E1QEz8P7giPiql2YMxURO9TV0tbl4M9hNG0/S6ka/naF8pIUnz7Um1nHGiBsMh9IyJAMhdWJ1nN3p1dnG3ixvyf1Mb8+7sbHjRgdUA3L8/HTBOCp+twB9uG+GfFEdheyHcnbxdtkByLzx2GbEnLNZZ99pF9i/cdpcaWCpnnqf/6TNVpFyCWhSfBq8+4OKUHt5vDB

On windows

  • Download PuTTYgen
  • Launch PuTTYgen
  • Select RSA and click the “Generate” button

Generate SSH key with PuTTYgen

  • Two keys are generated (a public key that we will be copy on your instances, and a private key that you must keep secret)
  • Fill-in the Key-comment field with a name to help you identify this key pair
  • Click the “Save public key” button and save it in the folder of your choice
  • Click the “Save private key” button and save it the same folder
  • Select the public key content. Copy it (below “Public key for pasting into OpenSSH authorized_keys file”) into your clipboard which is required for step 2

Copy SSH key generated by PuTTYgen

Step 2 - Save the content of the public Key on the SSH Keys section

You now must save the content of the public Key in the Control Panel.

  • From the Control Panel, open the drop-down menu on your account name and click on Credentials link.

My account

  • In the SSH Keys section click on Add SSH Key and paste the content of your public key in the text area, then on Add SSH Key.

My account

You are now ready to create and start your first instance!

Discover a New Cloud Experience

Deploy SSD Cloud Servers in seconds.