creating_ssh_key_pairs_on_windows.md 2.73 KB
Newer Older
Caughlin Bohn's avatar
Caughlin Bohn committed
1
p+++
Adam Caprez's avatar
Adam Caprez committed
2
3
4
title = "Creating SSH key pairs on Windows"
description = "How to create key pairs for use with Anvil on Windows"
+++
5
6
7

To create SSH keys on Windows, a companion program to the popular SSH
client PuTTY will be used.  Download and install the PuTTY package
Adam Caprez's avatar
Adam Caprez committed
8
9
at [this link](https://the.earth.li/~sgtatham/putty/0.70/w32/putty-0.70-installer.msi).
This will install both PuTTY itself and the PuTTYgen program to
10
11
12
13
14
generate the key pair.

Once installed, start PuTTYgen.  Click the *Generate* key to create the
key pair.

Caughlin Bohn's avatar
Caughlin Bohn committed
15
{{< figure src="/images/PuttyGen-Generate.png" height="450" >}}
16
17
18
19
20
21
22

You will be promoted to move the mouse in a random fashion within the
window for several seconds to create the key.  Once the key is
generated, the public and private keys need to be saved to different
files.  The public key is in the text box near the top of the PuTTYgen
window.  Right click within the box and choose *Select All*.   

Caughlin Bohn's avatar
Caughlin Bohn committed
23
{{< figure src="/images/PuttyGen-Select.png" height="450" >}}
24
25
26
27
28
29
30

Either right-click again and choose *Copy* or use *Ctrl-C* to copy the
key text.  Paste the key into a text editor of your choice.  Save the
file somewhere convenient, making sure to **save the key as plain text
only. ** This public key will later be added to your Anvil account for
SSH access to your instances.

Adam Caprez's avatar
Adam Caprez committed
31
32
{{% notice info %}}
The filename does not matter. By convention, both keys are named the
33
34
35
same, with a '.pub' extension added to the public one.  For example, the
public key would be named `anvil_key.pub`, and the private key
just `anvil_key`.
Adam Caprez's avatar
Adam Caprez committed
36
{{% /notice %}}
37
38
39
40
41
42
43
44
45
46

The private key will actually need to be saved twice.  This is because
PuTTY uses its own PPK format for private keys, and the
command-line `ssh` program uses the OpenSSH format.  Depending on which
program you're using to connect, you'll need to use the appropriate
file.  

To save the private key for use with the `ssh `command, choose *Export
OpenSSH key* under the *Conversions* menu.

Caughlin Bohn's avatar
Caughlin Bohn committed
47
{{< figure src="/images/PuttyGen-Export.png" height="450" >}}
48
49
50
51

A pop-up box will appear warning about saving the key without a
passphrase; select *Yes* to continue.

Caughlin Bohn's avatar
Caughlin Bohn committed
52
{{< figure src="/images/PuttyGen-Password.png" >}}
53
54
55
56
57

Save the OpenSSH private key somewhere convenient.  

To save the PuTTY format file, click the *Save private key* button.

Caughlin Bohn's avatar
Caughlin Bohn committed
58
{{< figure src="/images/PuttyGen-PrivateKey.png" height="450" >}}
59
60
61

An identical warning box to before will appear; click *Yes* to continue.

Caughlin Bohn's avatar
Caughlin Bohn committed
62
{{< figure src="/images/PuttyGen-Password.png" >}}
63
64
65
66
67
68
69

You may need to change the filename slightly to avoid overwriting the
OpenSSH key file.  Save the `.ppk` file somewhere convenient.

**Treat the private key file the same as you would a password.  Keep
your private key in a secure location and do not share it with anyone.**