KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

SSH Key Generation

Category: Getting Started
Tags: # # #

What is Secure Shell?

Secure SHell (SSH), sometimes known as Secure Socket Shell, is a UNIX-based command interface and protocol for securely getting access to a remote computer. It is widely used by network and systems administrators to control Web and other kinds of servers remotely.

Creating an SSH Key

It is simple to create an SSH key for use on our Services. The following is a guide for creating an SSH key for use with our Services for Windows and Linux. We do not have any Mac devices so we do not have a guide for you, unfortunately.

Windows

Download PuTTYgen from Putty Download Page. Please use the latest version only and remember, update your PuTTY, PuTTYgen installation from time to time!

  1. Download and start the puttygen.exe generator that you downloaded above…
  2. In the “Parameters” section choose SSH2 RSA, preferably for SSH version 2 and press Generate.
  3. Move your mouse randomly in the small screen in order to generate the key pairs.
  4. Enter a key comment, which will identify the key (useful when you use several SSH keys).
  5. Type in the passphrase and confirm it. The passphrase is used to protect your key. You will be asked for it when you connect via SSH. This is optional, as it is perfectly fine to not enter a password, opting to use password-less SSH keys.
  6. Click “Save private key” to save your private key.
  7. Click “Save public key” to save your public key.

Congratulations, you’ve created your SSH key for use with our Services!

Next, learn how to use SSH to connect to KnownHost servers.

Providing the Public SSH Key to Support

If you’ve not closed PuTTYgen already, you’ll see the option to Load an existing private key file with a button labelled Load.

Click that button and navigate to where your saved private key is. It will then show you the public key to install on your server.

It will typically be prefixed by ssh-rsa AAAA[LONGSTRINGOFCODE].

Highlight it, copy it to a text file and save it on your computer. You will need it to install on the server and authenticate yourself properly.

Linux

It is assumed that you have some Linux command-line knowledge. If not, the steps are as follows…

  • Open Terminal in your preferred distribution.
  • Run the below commands to generate an SSH key.
  ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  # Creates a new ssh key, using the provided email as a label
  Generating public/private rsa key pair.
  • When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
    • Save it in a location that you can easily reach, in which to save the key The default is usually `/home/example/.ssh/id_rsa` where `example` is your account username. Our recommendation is to simply accept the default by pressing enter.
  • At the prompt, type a secure passphrase, as you might see in the following example
  Enter passphrase (empty for no passphrase): [Type a passphrase]
  Enter same passphrase again: [Type passphrase again]

It’s fine if you choose not to use a password, instead using a password-less SSH key to log into our Services.

Congratulations, you’ve generated your own SSH key!

Once you’re ready to access our Services via SSH, you’ll be able to use

  ssh-copy-id

For example, if you wanted to install your SSH key into your server, you can do so via

  ssh-copy-id user@example.com