Fancy increasing your ssh security? Worried people could login remotely as you if they steal your password? Want to remove the need to type a password at all?
Well, you’re in luck because you have the option of using public and private keys! What you do to generate these keys really depends on which operating system your client is running. I’ll approach this from my usual connection setup, from Windows XP to FreeBSD using Putty.
Putty has a tool for generating public/private key pairs. You will need to download a tool called PuTTYgen from the following url:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Run PuTTYgen and click the Generate button. It will ask you to move the mouse around to generate some randomness used to generate the keys.
Save the public key and upload it to your FreeBSD server into the /home/username/.ssh/ folder as authorized_keys
If you want to use a password as well as the keys, type it in the fields labelled Key passphrase and Confirm passphrase and save the private key. You can choose not to use a password at all - this will mean your login will suceed with no user interaction.
Save the public key in a safe location.
Open Putty and setup your connection as normal. Select the option Auth (under Connection > SSH) and browse for your public key file.
Now when you connect, your Private Key will be authenticated against the Public Key stored in your home directory on the server. Depending on whether you entered a passphrase when generating the Private Key, you will be presented with a password prompt.
September 4th, 2008 at 11:37 pm
I was having issues getting ssh to work, tried many tutorials, I followed these instructions (much shorter than all the rest) and had instant success. Thanks.