PuTTYgen-HOWTO

From Global Shellz Wiki
Jump to: navigation, search
The primary purpose of this PuTTYgen HOWTO is to aid Global Shellz users setup an SSH key for use with PuTTY, however it can be used to create keys for other servers with little if any real changes to the process.


Launching PuTTYgen

Once you open PuTTYgen, you will see this default screen:


File:Puttygen-key-howto-1.png


Configuring PuTTYgen

The first thing we do is check the very bottom option label: Number of bits in a generated key:. By default this is set to 1024 bits. The Global Shellz servers use 2048 bit keys, so we want to match them with our key. So in the lower right hand corner, we update the bits from '1024' to '2048' as seen below:


File:Puttygen-key-howto-2.png


Next we will need to generate some randomness for the SSH key to be created with. To do this, just move your mouse randomly over the blank area in the middle of PuTTYgen:


File:Puttygen-key-howto-3.png


Once you have generated the acceptable amount of randomness required for your SSH key, you will the following screen below. At this point you have a few chances to make some changes before saving your private SSH key. You can update the Key comment: with something to describe what the key is for, such as 'joe@home' or 'joe@work'. The other option is to add a Passphrase for the ssh key. Most people do not add a passphrase so they can log into their shell without typing either a password or a passphrase. The reason for the passphrase is in case anyone obtains your private ssh key, then could access any servers than you have added the key to. This is your own decision to make.
If you have made any changes or decided not to, the next thing you want to is click on Save private key which is highlighted in the image below. Pick a place on your computer and save your private key there, but make sure you remember where you saved it, so you can point PuTTY to it later.


File:Puttygen-key-howto-4.png


Setting up your SSH key

Now that we have saved our private SSH key locally on our computer, now we have to get the public key to our preferred Global Shellz server. The easiest method for this option is to log into the server with PuTTY and once you are in your shell perform the following command:
user@us.gshellz.org:~/ $ cd .ssh/
If you do not have an existing .ssh directory then we need to create one real quick like so:
user@us.gshellz.org:~/ $ mkdir .ssh
From inside .ssh/ we want to create a file called 'authorized_keys' and edit it:
user@us.gshellz.org:~/.ssh/ $ vim authorized_keys
With your shell window still open, we want to go back to PuTTYgen, copy the highlighted public key (as seen below) and Right-Click in your PuTTY window to paste the public key into your 'authorized_keys' file.


File:Puttygen-key-howto-5.png


Back in your PuTTY session, we need to save and exit from the 'authorized_keys' file by pressing 'Esc' then:
 :wq
This will bring you back to your .ssh/ directory. We need to secure this file by making readable only to ourselves (or you) by changing the permissions like so:
user@us.gshellz.org:~/.ssh/ $ chmod 600 authorized_keys
Now log out of your existing PuTTY session and open your session settings for your Global Shellz connection. We want to click on "Load" so it loads all the existing session data and we don't have to retype a bunch of information. Go to Connection -> SSH -> Auth. Now you need to remember where you saved your private SSH key at this point. Click on Browse under Private key file for authentication:. Select the location of your key.


File:Putty-ssh-howto-3.png


Make sure you go back to Session and save the change we just made to our Global Shellz connection. Now go ahead and attempt to connect to the server. You should be logged in automatically without any prompting for a password.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox