Generating an SSH Public Key on Windows

The Windows operating system does not ship an SSH client or utilities to create cryptographic keys. In this book, we use the Git Bash third-party tool, but we could also use Git Shell or Putty. We can install Git, Git Bash and Git GUI from http://www.git-scm.com/download/win.

Let’s start with creating the public key for our SSH connection. On Windows open Git Bash and enter the following command:

ssh-keygen –f dockerhostkey

Next we are asked to enter a passphrase. We don’t have to enter one, but using a passphrase provides a little more security. It prevents anyone obtaining the key from using it without the passphrase.

The Git Bash console should now look similar to the one shown in Figure 2.3.

Image

FIGURE 2.3: SSH key generation in Git Bash

The next step is to go to the directory from where you have executed the command. In this case, the directory to go to is c:Container BookMisc. The directory contains two files:

dockerhostkey: This file contains the private key; never share this file with anyone.

dockerhostkey.pub: This file contains the public key; you can share this file with others. We need to open this file with a text editor of our choice and copy the key.

When opening the *.pub file on Windows in Notepad we need to make sure to copy the key with a new line at the end (we can delete the username@machine first and then move our cursor to the last character of the key/file and add a new line). Without having a new line, the image will fail to provision, as Linux cannot generate a *.pem file due to a malformed key during provisioning.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.16.81