TortoiseSVN+Putty SSH access to OpenModelica repository ------------------------------------------------------- From adrpo@ida.liu.se Thu Oct 12 21:50:35 2006 Date: Thu, 12 Oct 2006 21:50:35 +0200 (CEST) From: Adrian Pop To: pelab-modelica@ida.liu.se Subject: setting up ssh for TortoiseSVN via putty Hej, This mail is for persons that need to setup their ssh+svn access to the Subversion repository. There is a howto here: http://tortoisesvn.net/?q=node/5 in case I forget something out. Notes: - All the variables in howto will be written WITH_CAPS. - Be very careful what you do with your private key (especially the ones without passphrase) as anyone that can get their hands on it can login into your work account! 1. Install TortoiseSVN from here: http://tortoisesvn.net/downloads (requires restart as it is hooks into windows explorer) 2. Download putty tools: putty, plink, pageant, puttygen Use the installer for all the above tools: http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.58-installer.exe Or just download these: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe http://the.earth.li/~sgtatham/putty/latest/x86/pageant.exe http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe Read more about putty here if you want http://www.chiark.greenend.org.uk/~sgtatham/putty/ 3. Set up your putty session: Run putty and give: Host Name (or IP address): remote.ida.iu.se Saved session: SESSION_NAME Press Save (it appears below) Go to "Connection->Data" in the left part and say Login Details: Auto-login username: YOUR_USERNAME Go to Session and press Save to save the session. 4. Login into remote.ida.liu.se edit .login and add as the last line: source ~/.cshrc edit .cshrc and add as the last line: setenv PATH /sw/subversion-1.3.2/bin/:$PATH [Note: you will have to change this from time to time as TUS update the Subversion] 5. Generate public/private keys on remote (see session examples below): USER@gedrix ~> mkdir keyz USER@gedrix ~> cd keyz USER@gedrix ~/keyz> ssh-keygen -b 1024 -t dsa -f KEY_NAME This will ask for a passphrase (a password to the private key). There are 2 ways to proceed here [**b) is Safer!**]: a) choose no passphrase (no pageant.exe needed) b) choose some passphrase but then you have to start pageant.exe at Windows startup so that you don't have to enter the passphrase over and over again. For example put it in Start->Programs->Startup Copy the public key to your authorized_keys: USER@gedrix ~/keyz> cp KEY_NAME.pub /home/YOUR_USERNAME/.ssh/authorized_keys Chmod your keys so only you can read it (Thanks to Peter. A for the feedback): USER@gedrix ~/keyz> chmod 600 /home/YOUR_USERNAME/.ssh/authorized_keys 6. Copy the private key KEY_NAME file to your windows machine. There are several ways to do this [**a), d), e) are Safer!**]: a) At work, just copy it from your home mapped as a network drive b) put the key in your /home/YOUR_USERNAME/www-pub/SOMEPLACE/KEY_NAME then go with your browser to: http://www-ida.liu.se/~YOUR_USERNAME/SOMPLACE/ and download it. Important: Don't forget to delete it afterwords!!!! Sometimes Internet Explorer doesn't copy the file right, try using Firefox or some other copy method if this doesn't work. c) mail the key your yourself as attachment then delete the email! d) use WinSCP: http://winscp.net/eng/index.php e) use pscp from putty within a cmd window: pscp YOUR_USERNAME@remote.ida.liu.se:/keys/KEY_NAME .\ 7. Convert the private key so that it can be used by putty: Start puttygen.exe, then press Conversion->Import key Browse to where you copied KEY_NAME file and load it. Press: Save private key then enter a name: KEY_NAME.ppk 8. Open putty.exe again, then say Load on SESSION_NAME Go to Connection->SSH->Auth in the left part, say Browse and give it the KEY_NAME.ppk there. Go to Session and press Save. 9. Create a directory, say DRIVE:\MY_WORK_DIRECTORY Open Windows Explorer right click on MY_WORK_DIRECTORY and say: SVN Checkout... [TortoiseSVN opens] URL of repository [**Use Session Name from Putty!!**]: svn+ssh://SESSION_NAME/home/pelab/subversion/modelica/OpenModelica/trunk Checkout directory: DRIVE:\MY_WORK_DIRECTORY\OpenModelica That's it! Please let me know of any problems with this howto as I want to put it online someplace for future uses. Session example for 5: ---------------------- adrpo@gedrix ~/keyz> ssh-keygen -b 1024 -t dsa -f key_for_adrpo Generating public/private dsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in key_for_adrpo. Your public key has been saved in key_for_adrpo.pub. The key fingerprint is: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX adrpo@gedrix.ida.liu.se adrpo@gedrix ~/keyz> ls -la total 8 drwxr-xr-x 2 adrpo ida 512 okt 12 21:07 ./ drwx--x--x 80 adrpo ida 4608 okt 12 20:59 ../ -rw------- 1 adrpo ida 668 okt 12 21:07 key_for_adrpo -rw-r--r-- 1 adrpo ida 613 okt 12 21:07 key_for_adrpo.pub adrpo@gedrix ~/keyz> cp key_for_adrpo.pub /home/adrpo/.ssh/authorized_keys adrpo@gedrix ~/keyz> chmod 600 /home/adrpo/.ssh/authorized_keys adrpo@gedrix ~/keyz> ---------------------------- Cheers, Adrian Pop/ _____________________________________________________________________ Adrian Pop | PhD Student Department of Computer Science | http://www.ida.liu.se/~adrpo Linköping University | phone:+46 13 285781/+46 76 2343499 S-581 83 Linköping, Sweden | fax: +46 13 142231 LiU/IDA/PELAB | office: 3B:478