The following steps outline the process of using Public Key authentication for SSH with Putty as your client. If you follow the entire guide and get it right, you will not have to type in your username/password for the servers you have setup.
Install Files
Copy putty.exe, puttygen.exe, pscp.exe, pftp.exe and pageant.exe to c:\windows\system32
Generat your key pair.
Start -> Run -> puttygen
Change the “Number of bits in a generated key” from 1024 to 2048 or what ever value you would like.
Click Generate
You will need to move the mouse around in the area with the progress bar till the bar completes. This process is generating random data to create your key from.
Once complete, it will display the key contents.
In the key-comment box, change the value to something you will recognize.
Enter a passphrase and repeat it.
Click the “Save private key” button and save your private key. I saved mine to My Documents with the same name I placed in the comments.
Click the “Save public key” button and do the same. I changed the extension to .pub for identification.
Next you need to copy the Public key from the top box. Be sure to get the entire thing. It will start with ssh-rsa and end with what you typed in the comments.
Paste the contents below replacing the line that says “<Paste authorized key data here, overwriting this line>”. None of the existing text should remain.
Log onto each server and paste the following lines. This will create the .ssh folder, authorized_keys file, and correct the permissions.
cd
mkdir .ssh
chmod 0700 .ssh
cat << EOF > .ssh/authorized_keys
<Paste authorized key data here, overwriting this line>
EOF
chmod 0600 .ssh/authorized_keys
Close puttygen.
Setup your saved sessions in Putty.
Start -> Run -> putty
Adjust Default Session.
These steps will set the default settins of your instance of Putty to use the private key you just generated.
In the Saved Sessions box, select Default Settings and click load.
Browse the tree on the left to Connection -> SSH ->Data
Enter your username in the Auto-login username box.
Browse the tree on the left to Connection -> SSH -> Auth
Click the browse button and select the private key you saved earlier. It will have a .ppk extension.
Browse back to the Session section on the left.
Click Save.
Existing Sessions.
Repeat this process for each server you created the authorized_keys file on either by changing an existing saved session or creating a new one.
Testing Public Key authentication
Using a session you have setup as above, connect to the server.
You should be prompted for your key passphrase. If you are not, you have done something wrong and you need to troubleshoot.
Once you get it working, move onto the Putty Agent section.
Putty Agent
The following steps create a shortcut in the startup folder so each time you logon the Putty Agent will automatically start and load the private key.
Start -> All Programs -> Right-click on Startup, click open.
Right-click on the window, select New -> Shortcut
In the field enter: pageant "c:\path\to\private_key.ppk"
Mind the quotes around the path.
Click next.
Give it a name such as “Putty Agent”
Click finish.
Test Public Key authentication with Putty Agent.
Start -> All Programs -> Startup -> Putty Agent (Or what ever you named the shortcut.)
You will be promoted to enter the passphrase for your privage key.
Enter the passphrase.
You will now see a little computer screen with a hat on it in the system tray.
Open putty and use one the sessions setup previously for Public Key authentication.
This should log you in automatically with out prompting for a password or passphrase.
no comment untill now