For one of my projects, I use the Media Temple Grid Service for hosting. They offer ssh access to the hosting, which is superb and coupled with svn repositories, enables me to keep all the source there too.
Using a nice, secure complex password to log on with the ssh client, my IDE and my svn client is very tedious – I have to dig out the password every time. It was therefore imperative that I configured the ssh private-public keys so that I could login automatically.
It took me a while to figure it out first time and recently something happened with their servers that caused my ssh login root directory to change (of course they denied this), causing my ssh keys and a few scripts I had to ‘disappear’. This meant that I needed to setup the keys again and although not as bad as the first time, it still took longer than it should. I therefore log the process here to help others that may struggle with setting them up and as a reminder to myself, should another ‘incident’ occur at Media Temple. Here is the process:
- Ensure you have putty, puttygen and psftp installed/downloaded
- Login to your MediaTemple account using putty
- Type: ssh-keygen -t rsa
- Follow the instructions to generate the keys. Do not use a pass phrase as we want autologin.
- You should now have id_rsa and id_rsa.pub in the .ssh directory
- Change directory into .ssh and type: cat id_rsa.pub >> authorized_keys2
- FTP into you MediaTemple account using psftp and download the id_rsa file. For Vista users, watch out for UAC. Its best to ensure you download to a safe directory like your desktop
- Open up puttygen and select from the menu: conversions->Import Key
- Select the id_rsa key file you downloaded and puttygen should then import it
- Click Save Private Key and save the .ppk file in a place of your choice
- Open up putty and fill in Connection->Data ‘login username’. Then go to Connection->SSH->Auth and select your newly created .ppk file when you click on ‘private key file for authentication’
- Save the putty session. This session should now login automatically
The important point here is that the keys were created on the server and then imported to putty. Many of the guides I found create the keys with putty in the first place and that just did not work for me.