OVH Guide

Create SSH keys

Tutorial on creating SSH keys on Linux or Windows

Preamble

When you create an instance, you won't receive an email with your credentials. To securely connect, you will need to configure an SSH key before creating an instance. This makes it possible to connect:

  • Without having to remember a password
  • In more secure manner than using a passwords

This guide details the steps to be taken to configure your key.

Linux & Mac

Creating the key

- Open terminal - Enter the following command to enable the generation of a 4096 bit SSH key:

ssh-keygen -b 4096
  • The following result is obtained, the command prompts you to change the location of the private key:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):

The private part of the key should be kept safe, and its access should be limited to only people authorized to use it.

  • The following step consists in configuring a passphrase for your key SSH key:

Setting a passphrase to protect the key is recommended, do not hesitate to enter a secure password (upper/ lower case / numbers/special character and a minimal length of 8 characters).

Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
0a:3a:a4:ac:d1:40:6d:63:6d:fd:d9:fa:d6:b2:e0:36 user@host
The key's randomart image is:
+---[RSA 4096]----+
|      .          |
|                 |
| .               |
|. . . .          |
|. .=.o .S.       |
| =o.o. ..   .    |
|o +   .  . o ..  |
|.. .      oEoo . |
|o.        .o+oo  |
+-----------------+
  • Read and display the public key using the following command:
cat .ssh/id_rsa.pub
  • In our example:
cat /home/user/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8teh2NJ42qYZV98gTNhumO1b6rMYIkAfRVazl
k6dSS3xf2MXJ4YHsDacdjtJ+evXCFBy/IWgdkFtcvsGAMZ2N1RdvhDyQYcy6NDaJCBYw1K6Gv5fJ
SHCiFXvMF0MRRUSMneYlidxU3U2q66yt/wPmw1yRsQagtNKHAzFUCSOB1nFz0RkqvqgARrHTY0bd
aS0weA//aK9f6z+Y4THPbcCj4xPH4iGikFMPrFivP8Z6tidzVpAtbr1sXmJGZazYWrU3FoK2a1sF
i4ANmLy7NULWK36yU0Rp9bFJ4o0/4PTkZiDCsK0QyHhAJXdLN7ZHpfJtHIPCnexmwIMLfIhCWhO5
 user@host

On Windows

Using Putty

Putty is the most popular SSH client for Windows

  • Download the software puttygen allowing to generate the key
  • Run the software to generate the key
  • At the level of 'Number of bits in a generated key', specify the value 4096

public-cloud

  • Click on Generate (move the mouse in the grey frame during the action)
  • Specify a passphrase to password protect the key
  • Save the private key by clicking on Save private key, name this file (key.rsa for example)
  • Copy the public key displayed in the frame

public-cloud

  • Start Putty
  • In the list on the left, click on Connection, then on SSH, and Auth
  • At the level of the 'Private key file for authentication' line, click on Browse, select the private key, validate.

public-cloud

  • Click on Open in Putty.

Using CygWin

Cygwin suggests an alternative approach, and enables the installation, on Windows, of many GNU libraries.

Choosing the nearest mirror to you is recommended (.fr domain or European ISP)

  • At the Select Packages step, in the Search field, specify SSH
  • In the Net tree, click on the line openssh The OpenSSH server and client programs
  • Click on Next
  • Start the CygWin software
  • The rest of the procedure is identical to that necessary on Linux/Mac OS.