I recently sign up for koding account. koding provides an Ubuntu VM and you can connect to it through local machine using SSH client. Now the problem is I am using Windows to connect to Ubuntu VM provided by Koding and I did not find any good documentation in regards of How to generate SSH keys Windows Machine, hence though I should right mine.

SSH keys serve as a means of identifying yourself to an SSH server using public-key cryptography and challenge-response authentication. One immediate advantage this method has over traditional password authentication is that you can be authenticated by the server without ever having to send your password over the network. SSH keys always come in pairs, one private and the other public. The private key is known only to you and it should be safely guarded. By contrast, the public key can be shared freely with any SSH server to which you would like to connect.

There are three steps in this How to generate SSH keys Windows.

  • Generate a new SSH key using PuttyGen utility.
  • Configuring SSH keys on remote server.
  • Connecting remote server using our generated SSH keys.

We will be using following two tools for this How to generate SSH keys Windows tutorial

  • PuttyGen
  • Putty

Detailed steps of How to generate SSH keys Windows are as follows

Step 1: Generate a new SSH key
This is the first step of How to generate SSH keys Windows. In this one we will be generating SSH keys

  • To generate SSH key on Windows machine you need a utility called PuttyGen. You can download it from following link
    Download PuttyGen
  • Copy the utility to easy to remember folder location. I am storing it in E:\techienote\PuTTY folder.
  • How to Generate SSH keys on Windows

  • Start the PuTTYgen utility, by double-clicking on its .exe file.
  • How to Generate SSH keys on Windows

  • For Type of key to generate, select SSH-2 RSA.
  • In the Number of bits in a generated key field, specify either 2048 or 4096 (increasing the bits makes it harder to crack the key by brute-force methods)
  • Click the Generate button
  • Move your mouse pointer around in the blank area of the Key section, below the progress bar (to generate some randomness) until the progress bar is full
  • How to Generate SSH keys on Windows

  • A private/ public key pair has now been generated
  • How to Generate SSH keys on Windows

  • In the Key comment field, enter any comment you’d like, to help you identify this key pair later
  • Type a passphrase in the Key passphrase field & re-type the same passphrase in the Confirm passphrase field (if you would like to use your keys for automated processes, however, you should not create a passphrase). We are not going to use it here, so this one is optional.
  • Click the Save public key button & choose whatever filename you’d like. I am using public_key_koding.txt and storing it in E:\techinote\puTTY folder
  • Click the Save private key button & choose whatever filename you’d like. I am using private_key_koding.ppk and storing it in E:\techinote\puTTY folder
  • How to Generate SSH keys on Windows

  • Now there is one catch. On linux we use OpenSSH for SSH and the format is little but different. Hence from the Public key field copy all the text (starting with ssh-rsa) and paste it in a file. We will be saving it in public_key_koding_OpenSSH.txt under E:\techinote\puTTY folder
  • How to Generate SSH keys on Windows
    How to Generate SSH keys on Windows

Step 2: Use the Key Pair and configure it on Koding server
This is the second step of How to generate SSH keys Windows. In this one we will be configuring the generated SSH keys to the remote machine

  • Ensure that your server to which you are going to connect is started.
  • Next, we need to create a file called authorized_keys on server. In this case we are going to use Koding VM. Run the following commands in your Terminal.
    mkdir -p ~/.ssh
    touch ~/.ssh/authorized_keys
  • Once the file is created, we need to copy/paste the contents of public_key_koding_OpenSSH.txt file into it. Now, open up the authorized_keys file that you just created, and paste in your public key. To open the file you can use a Terminal editor such as Nano or Vim, or simply use the File Explorer on the left hand side (in case of Koding VM) to open the ~/.ssh/authorized_keys file. Once the key has been pasted in, save the file.
    How to Generate SSH keys on Windows

Step 3: Configuring puTTY to connect our server
This is the third step of How to generate SSH keys Windows. In this one we will be configuring our SSH client to connect to a Remote SSH server

  • PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator. You need to download it from following link
    Download puTTY
  • Copy the utility to easy to remember folder location. I am storing it in E:\techienote\PuTTY folder.
    How to Generate SSH keys on Windows
  • Start the putty utility, by double-clicking on its .exe file.
    How to Generate SSH keys on Windows
  • In the Category menu on the left, under the Connection menu, open up the SSH menu and select Auth. Browse to the location of the key file and load the private key in our case it is private_key_koding.ppk.
    How to Generate SSH keys on Windows
  • In the Category menu on the left, click on Session. Enter hostname of the machine to which you want to connect in the Host Name (or IP address) field.
    How to Generate SSH keys on Windows
  • To make PuTTY use the key every time that you connect to your Server, save the configuration by entering a name in the Saved Sessions filed and click on Save button.
    How to Generate SSH keys on Windows
  • Click on Open button to connect the server. It will ask the username to connect to the server. After entering the correct user name hit enter.
    How to Generate SSH keys on Windows
  • In case of successful login you will see the prompt.
    How to Generate SSH keys on Windows

If you find any missing point in here, please let us know in comment section or tweet us at @techienotecom. To get more articles like this, subscribe to our RSS feeds.

How to Generate SSH keys Windows
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recommend on Google