Saturday, April 10, 2010

Putty, SSH, Public/Private key authentication, passwordless

Go to Start --> All Programs --> Putty --> PuTTYgen

Set type of key to generate SSH-2 RSA and number of bits in a generated key to 2048. Click the "Generate" button and move the mouse to generate your unique key.

























When that's finished, Click "Save public key" to save your public key to a file, e.g. mykey.pub. Click "Save private key" and save it as e.g. mykey.pkk. SSH to your server with e.g. myuser, user account.
mkdir /home/myuser/.ssh       
echo "ssh-rsa AAAAAWNzaC1KEcNZLmBl1poSrNCQ9o5rv5ts+txlu8eFvwk== rsa-key-20100410" >> /home/myuser/.ssh/authorized_keys
NOTE: For the purposes of this tutorial, I've shorten the random characters of the key. Also know that the whole part that you echo needs to be on one line, in other words, the part that is in quotes.

Go to Start --> All Programs --> Putty --> PuTTY

Set up your Session:

























Under Connection --> Data


 

 

 

















Under Connection --> SSH --> Auth
Click "Browse" and browse for the mykey.pkk file that you saved earlier.
























Go back to Session and click "Save". You will now have a new session entry, REMOTEHOST, that you can double-click and PuTTY will automatically login as the myuser username to your REMOTEHOST box.