public-and-private-ssh-keys

JSON

rev 5  |  foxhop  |  1373565694000  |  JSON

rev 4
rev 5
15======================================================15======================================================
1616
n17Create a ssh public/private keypair::n17Create a ssh public/private keypair:
18 
19.. code-block:: bash
1820
19 ssh-keygen -t rsa -b 4096   #enter a passphrase when asked21 ssh-keygen -t rsa -b 4096   #enter a passphrase when asked
3840
39Keep all your private keys in the same directory with the .key extension. 41Keep all your private keys in the same directory with the .key extension. 
t40Use the following script to add all private .key files to ssh agent::t42Use the following script to add all private .key files to ssh agent:
43 
44.. code-block:: bash
4145
42 for f in *.key; do ssh-add $f; done46 for f in *.key; do ssh-add $f; done
rev 4  |  foxhop  |  1373565564000  |  JSON

rev 3
rev 4
27The user's *authorized_keys* file may contain none or many keys.27The user's *authorized_keys* file may contain none or many keys.
2828
n29Permissions:n29.. warning::
30 *authorized_keys*: 30 
31   file must be mode 40031 The *authorized_keys* file must be mode 400
32 *.ssh*:32 
33  directory must be mode 70033 The *.ssh* directory must be mode 700
3434
3535
44The SSH agent will prompt for each key's passphrase in turn. 44The SSH agent will prompt for each key's passphrase in turn. 
45This must be done after each reboot.45This must be done after each reboot.
tt46 
47Could not open a connection to your authentication agent
48---------------------------------------------------------------
49 
50You must have a running ssh-agent and your shell must have access to use it.
51If you get this error message when you attempt to run ssh-add then
52first run the following command to spawn an ssh-agent for this shell:
53 
54.. code-block:: bash
55 
56 eval "$(ssh-agent)"
57 
58Now try to run ssh-add again.
59 
60Another command for debugging:
61 
62.. code-block:: bash
63 
64 echo $SSH_AUTH_SOCK
4665
47How to create a putty ppk66How to create a putty ppk
rev 3  |  foxhop  |  1373472104000  |  JSON

rev 2
rev 3
t No Differences Found t No Differences Found 
rev 2  |  foxhop  |  1373472103000  |  JSON

rev 1
rev 2
27The user's *authorized_keys* file may contain none or many keys.27The user's *authorized_keys* file may contain none or many keys.
2828
t29.. warning::t29Permissions:
30 30 *authorized_keys*: 
31 The *authorized_keys* file must be mode 40031   file must be mode 400
32 32 *.ssh*:
33 The *.ssh* directory must be mode 70033  directory must be mode 700
3434
3535
rev 1  |  foxhop  |  1373471878000  |  JSON

empty
rev 1
tt1Public and Private SSH Keys
2##############################
3 
4I tend to think of:
5 
6* a server host as a "house"
7* a public key as a "lock" on a door of a "house"
8* a private key as a "key" to the "lock" on a door of a "house"
9 
10In this way, anyone might have access to the outside of a "house".
11Anyone could have access to the "lock" on a house.
12Only you should have access to the private "key".
13 
14How to create a new public and private ssh keypair
15======================================================
16 
17Create a ssh public/private keypair::
18 
19 ssh-keygen -t rsa -b 4096   #enter a passphrase when asked
20 
21Document the passphrase in keypass
22 
23How to add the public key to a host
24====================================
25 
26Append the contents of .pub key to a remote host's ~/.ssh/authorized_keys.
27The user's *authorized_keys* file may contain none or many keys.
28 
29.. warning::
30 
31 The *authorized_keys* file must be mode 400
32 
33 The *.ssh* directory must be mode 700
34 
35 
36How to add a private key to your workstation
37===============================================
38 
39Keep all your private keys in the same directory with the .key extension. 
40Use the following script to add all private .key files to ssh agent::
41 
42 for f in *.key; do ssh-add $f; done
43 
44The SSH agent will prompt for each key's passphrase in turn. 
45This must be done after each reboot.
46 
47How to create a putty ppk
48===============================
49 
50#. Create a keypair: `How to create a new public and private ssh keypair`_
51#. SCP the keypair from unix host to windows host
52#. Download and open puttygen.exe
53 
54   * Click the *Load* button
55   * Browse to the private key,
56     might need to choose 'All Files(\*.\*)' from dropdown
57   * enter passphrase, click *OK*
58   * Click the *Save private key* bytton
59   * Name the new key with .ppk extension, and hit *Save*
60 
61#. Add the .ppk to putty.exe and test