Use Putty to ssh Into HostMonster
There are many helpful posts out there on how to do this.
This is written so that I can recall the exact steps I used that worked for me.
Starting Point
I am able to log on to my host using ssh (Putty) just fine. I have to log in using my host username (that my host sent me when I purchased the site this is hosted on) and password (that I set using cPanel tool). And that is fine, I don’t ssh into my account very often.
However, I am on a mission to set up another tool that needs to access my site that already requires authentication per project, and I don’t want to have to authenticate twice when it tries to connect to my host to do it’s magic.
Some don’ts: Don’t use Puttygen or the cPanel tool to create keypairs. They don’t work with my host/setup for some reason.
1. Create a key pair on the server using an ssh session in putty. Something like this:
ssh-keygen -b 1024 -t dsa -f keyName
It will prompt for a passPhrase. This is a well-intended gotcha – passphrase=password, which I already said I don’t want to deal with.
2. FTP to site – If you run the command to create the key pair when you are at the root of the site like I did, that is where you will find the key pair. Put the public key in a folder named .ssh and chmod 700. Change file name to authorized_keys and chmod 600.
3. Get the other key file to your local and delete from server – it is the private key and it should not be accessible on a server. Open puttyGen and select menu Conversions->Import Key and find the private key you just downloaded. Select menu File->Save As and leave name the same wtih .ppk extension. Now Putty can use it!
4. Open Putty – load connection Save Session if there is one close to what you will use with the keyed connection. Add the username you use to log in to the url: username@site.com. Save.
5. Open Category (Left pane) Connection/SSH/Auth and put path to private key (.ppk from step 3). Save
6. Click Open and the terminal window should show that you connect to host without any prompts required. Yay!
7. If you are willing to run Pagent all the time,. you can right-click it in the taskbar and add the ppk file to it’s list. Then you can delete the key path from the Putty Settings File and check “Attempt authentication using Pagent” in Authentication methods panel above.
8. to test from DOS window:
test connection via plink using command line. from c:program filesputty:
plink -i "c:pathtokey.ppk" user@hostname
Method that TortoiseSVN uses to connect:
> plink -i "c:pathtokey.ppk" putty_session_name