HomeConsoleMy ProjectHow to
Generate an SSH-key

Jump toUpdate content

How to generate an SSH key

Reviewed on 11 August 2022Published on 08 June 2021

SSH keys allow you to securely connect to your Instances without using a password. An SSH key consists of an RSA key pair, which has two elements:

  • An identification key (also known as private key), which you must keep securely on the computer you want to connect from.
  • A public key which you must upload to the Scaleway interface. This is then transferred to your Instance during the boot process.

You can generate the SSH key pair on your local machine. The process will depend on your operating system.


How to generate an SSH key pair on OSX and Linux

On OSX and Linux, you can generate the SSH key pair directly from the terminal (command line).

  1. Open the terminal application by clicking on the corresponding icon.

  2. Type ssh-keygen -t ed25519 -C "login" -Z aes256-gcm@openssh.com and press Enter to generate a new key.


    It is strongly recommended to use Ed25519 for increased security and performance. However, if for any reason you can not use these keys, you can create a RSA4096 key, as a fallback option, using the command ssh-keygen -o -b 4096.

  3. Enter a file path to save the key to when prompted. Alternatively, press Enter to leave this at the default setting (the key will be saved in a file called id_ed25519 in the user’s ~/.ssh/ directory).

    Enter file in which to save the key (~/.ssh/id_ed25519):`
  4. Enter a passphrase when prompted. This step is not mandatory, but is recommended for increased security. The passphrase can be freely chosen. If you do not want to set a passphrase, press Enter directly.

    Enter passphrase (empty for no passphrase):
  5. Enter the passphrase again for confirmation when prompted, and press Enter:

    Enter same passphrase again:

    The key pair is generated in the filepath you specified. The key pair consists of:

    • The public key, named id_ed25519.pub
    • The private (identification) key, named id_ed25519
  6. Display the content of the public key with the following command and copy it.

    cat /Users/me/.ssh/id_ed25519.pub
  7. Copy the content of the public key which is displayed. You will need this in the next step. Your key should look something like the output shown:

    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINPZxtCMs5sIfsMWpq7SHuqFFpBtSTmFqXWOYdf6dX4i me@example.com

How to generate an SSH key pair on Windows

On Windows, you can use the third-party application PuTTYgen to generate an SSH key pair.

  1. Download and install PuTTY to your local computer. The PuTTYgen application is automatically installed (as well as the main PuTTY application).

  2. Launch PuTTYgen by double-clicking on the application icon.

  3. Select EdDSA and click the Generate button. You can also add a passphrase before generating the key to increase security.

  4. Move the mouse around the blank area as instructed, to generate randomness.

    The public and private keys are generated and the following screen displays:

  5. Complete the steps on the screen to finish:

  • 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 content of the public key (the sequence of characters under “Public key for pasting into OpenSSH authorized_keys file”). Copy it, as you will need this in the next step.

How to upload the public SSH key to the Scaleway interface

You must upload the content of the public part of the SSH key pair you just generated to the Scaleway interface. This is then transferred to your Instance during the boot process. You can then connect and authenticate from your local machine (where the private key is) to the remote Instance (where the public key is).

  1. Log into the Scaleway console, and navigate to the Credentials tab of your Project Dashboard:

  2. Scroll down to the SSH Key section, and click Add a new SSH key.

  3. Paste the content of the public key (which you copied in the previous step) into the pop-up box, and optionally add a description. Then click Add a SSH key.

You will now be able to connect to your Instances via SSH


If you have any difficulties connecting to an Instance after uploading a new public SSH key to your Project, try the following:

  • If you cannot connect to your Instance at all via SSH, reboot your Instance from the console and try again.
  • If you can connect to your Instance using a previously uploaded SSH key but not the new one, go ahead and connect to your Instance with the old key. Once connected, run the scw-fetch-ssh-keys --upgrade command, which launches a script on your Instance to update your SSH keys. You can then check that the new key has been added to the authorized_keys file (~/.ssh/authorized_keys). Note that this command works only for Instances.
See Also