SSH Keys

Accessing your SSH Key via the Console

Windows

To generate an SSH keypair in windows download PuTTYgen from here. Follow the steps below:

  • Open the PuTTYgen.exe.
  • Click the “Generate” button in the lower right corner.
  • You’ll be asked to generate randomness by moving the mouse around, continue to do this until the load bar is full.
    • Click “Save public key” and you’ll be prompted for a location on your hardrive to save the file. This key will be given out to the public, and it’s not necessary to keep it hidden. It is recommended that you keep your public key with your private key, however, so save it to a secure location.
    • Click “Save private key” and save your private key to a secure location.

Open the public key file that you’ve saved in Wordpad (be careful note to use Notepad, as this will insert data, rendering it useless), and copy the random text. Copy your key into the “SSH Keys” section of your CloudAfrica profile page, by clicking the “New SSH Key” button. 


OS X and Linux

1. Check for an existing SSH key pair

We first need to make sure that there are no other SSH keys on your system that may cause problems with generating the new key. Open up your favourite terminal application and type the following:

$ ls ~/.ssh

The above command will either give you a listing of all files within the directory, or it will output “No such file or directory”. If the latter response is given, skip to step 3. Alternatively, if you would like to use an existing key-pair you may jump ahead to Step 4.

2. Backing up existing SSH keys

For safety’s sake we want to backup your current ssh keys:

$ cd ~/.ssh  
# Change directory into the SSH directory

$ mkdir key_backup  
# Create a directory to backup your keys to

cp id_rsa* key_backup  
# Copy your current keys into the key_backup directory

rm id_rsa*   
# Delete the id_rsa key-pair

3. Generate a new SSH key

To generate a new key pair type the following commands in your terminal:

$ ssh-keygen -t rsa -C "<your@email.address.com>"  
# Creates a new key using your email address  
Generating public/private rsa key pair.  
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

Enter a useful passphrase (A passphrase is similar to a password in usage, but is generally longer for added security):

Enter passphrase (empty for no pass phrase): [Type a passphrase]  
Enter same passphrase again: [Type passphrase again]

You will receive output similar to this:

Your identification has been saved in /Users/username/.ssh/id_rsa.  
Your public key has been saved in /Users/username/.ssh/id_rsa.pub.  
The key fingerprint is:  
eb:1f:6e:5a:bc:4a:16:6e:57:36:0f:93:47:8d:f7:2a your@email.address.com

4. Add your key to CloudAfrica

To get your key:

$ cat ~/.ssh/id_rsa.pub

Add your key into the “SSH Keys” section of your CloudAfrica profile page, by clicking the “New SSH Key” button.

Note: Be cautious not to add extra white spacing to it, as this will make it void.