Password Free Putty and TortoiseSVN
28, Mar 2011
Working on a Windows machine can be a bother when dealing with TortoiseSVN. No mater what action you take within the RepoBrowser, it seems like the program demands your password a minimum of 3 times. Today, I decided that I had had enough of this, and started looking into how to setup passwordless interaction between my Windows machine and Linux server. The route to achiving this lies through Public and Private Key encryption. To replace the standard password prompt, you need to generate a Private and Public key, put the Public key on the server, and let PuTTY know about the Private key stored locally on the client computer.
There seems to be very little information on this on the web, and what is out there, mostly left me frustrated. Different people will tell you to generate the keys one way or another, others will say that you need to use Pagaent, and others have no idea what is going on. Here's what worked for me:
Generating Your Keys
To generate your Private and Public Keys, you'll need to have the full PuTTY suite installed - not just the standalone SSH client. Open up PuTTYgen and click Generate, you'll be asked to move your mouse around in the window to create the random characters that make up the key. Once it has completed, add a key comment of the hostname of the server the key will be going on. Leave the Key passphrase blank, and click 'Save Private Key' - make sure you save it in a safe location (for example, not on a shared network drive). Select the block of text above the Key Fingerprint (begins with ssh-rsa) and copy that. That is the public key, and it is going on the server in the authorized_keys file. If you do not already have a .ssh folder in your home directory, create one, and make a new file called authorized_keys and paste the contents of the public key into that file. When done, save and exit. We now need to change the permissions on that file before it can be used:
chmod go-rwx ~/.ssh chmod go-w ~/.ssh/authorized_keys
Setting Up for Passwordless Access
Now the time has come to configure PuTTY for passwordless access. Open up the PuTTY client, put in the IP address or host name, and fill in a name under Saved Sessions. In the sidebar, go to Data (Connection -> Data) and put your username on the server in the Auto-login username field. Expand SSH and click Auth (Connection -> SSH -> Auth), and in the last field, browse for where you saved the private key. When you've selected it click back on Session at the top of the Category menu, and click Save. You should now be able to simply open that session (or double click on the session name) and be automatically logged in to your account.
What about Tortoise?
Once that has been accomplished, it's simple to get Tortoise working without a password. All you have to do is change the URL location to use the session name that you picked in PuTTY. For example if I had named my session computer1, and had checked out from svn+ssh://firstname.lastname@example.org/svn/repo, would just right click on the repository folder on my local machine, and go to TortoiseSVN -> Relocate and put in svn+ssh://username@computer1/svn/repo.
Have Something to Say?
Questions? Comments? Concerns? Let me know what you’re thinking.