1. Home
  2. Web Hosting
  3. Generate an SSH key
  1. Home
  2. Dedicated accommodations
  3. Generate an SSH key

Generate an SSH key

In this guide, we will see how to generate an SSH key.

Why generate an SSH key?

The public SSH key authentication method has many advantages.
The idea is to set up a tunnel between a client and a server that guarantees secure transactions.
The digital fingerprint of the used password is saved on the public SSH key.
The private SSH key is stored on the personal computer and therefore remains secret.
Even if unauthorized third parties manage to gain access to the public key, it would be almost impossible for them to decrypt the private key.
Thus, by relying on an SSH connection with a private key and a public key, the system exchanges data in a secure manner.

Our backup tool DrivinCloud allows to use SSH keys for secure data repository.

SSH key under WINDOWS

First press the Windows key + r on your keyboard at the same time, to open the run window.
Then enter cmd in the input field, then click on OK.
Then access in the path C:\UsersYourWindowsUser, via the command cd %userprofile%.
Execute the following commands respectively:
mkdir .ssh
cd .ssh
ssh-keygen
Put the file name. In this case the system inserts the key in the file.
Put a passphrase (twice).

It is possible to run the same commands using PowerShell.

Then access the .ssh folder created under the directory C:UserYourWindowsUser. There will be two files in it. One that contains the private key, the other contains the public key.
Then open the file mondomainekey.pub (which contains the public key) with NotePad or BlocNote or another text editor. Copy the key that starts with ssh-rsaand ends with YourUser@YourWindowsUser.
The key must not contain any line breaks.

Create the key in Mac OS

First open a terminal and run the following command:
ssh-keygen -t rsa -C votreadresse@mail.tld
then
cat /Users/myuser/.ssh/id_rsa.pub to recover the public key.

Generate a key under LINUX

All you need to do is :
First run the ssh-keygen command on a terminal.
Then indicate the file name in which the key will be inserted.
Put a passphrase (twice).
Run the command cat filename.pub to copy the generated public key.

The key must not contain any line breaks.

Updated on 28 September 2022

Related Articles