Saturday, February 05, 2005

CVS with SSH on Windows

Written for
  • Tortoise CVS - 1.8.11
  • PuTTY,PageAnt,PuttyGen,PLink - 0.56
  • WinCVS Beta 20 (build 3)
How this works.

Find out if you are going to be using Tortoise or WinCVS as your CVS client. Then pick the instructions for that client. Some of the steps are the same for both clients, so instead of typing them twice, I just reference which steps to use in that particular clients setup overview.

Tortoise CVS Client Setup Overview
  1. Download Tortoise CVS.
  2. Run the installer
  3. Setup SSH (Steps 1-5 below)
  4. Configure CVSROOT (Step 7 Below)
  5. Checkout Module (Step 7 Below)
WinCVS Client Setup Overview
  1. Download WinCVS.
  2. Run the installer
  3. Install CVSNT (this is an install option when installing WinCVS)
  4. Setup SSH (Steps 1-6 Below)
  5. Configure CVSROOT (Step 8. Below)
  6. Checkout Module (Step 9. Below)

1. SSH Setup Overview
  1. Download PuTTY,PageAnt,PuttyGen,PLink from the PuTTY web page.
  2. Generate Keys
  3. Configure PuTTY
  4. Configure PageAnt

2. Generate SSH Keys and install Public Key on Server.
  1. Open up PuttGen.
  2. Select SSH2 RSA and 1024 Bit
  3. Click on Generate Key button and move mouse around.
  4. Type in a password twice.
  5. Hit save public and save private key buttons. Save to a local drive.
  6. Copy the Public key from the top of the PuttyGen app window.
  7. Open a SSH connection to the server you want to connect to.
  8. Goto your home directory
  9. cd into .ssh (if it doesn't exist create it 'mkdir ~/.ssh')
  10. open authorized_keys2 file (if it doesn't exist create it 'touch ~/.ssh/authorized_keys2' )
  11. edit the authorized_keys2 file and paste the public key from puttygen into the file. (copy everything)
  12. Save authorized_keys2

3. Setup Putty to use private key to connect to server.
  1. Open PuTTY
  2. Enter HostName or IP address for server.
  3. select SSH
  4. Enter saved session name.
  5. Select the connection menu from the menu on the left..
  6. Enter username for the server in auth-login username.
  7. select SSH->Auth from the menu on the left.
  8. Browse to the private key
  9. click on session on the menu on the left.
  10. Hit save button.
4. Setup PageAnt to remember private Key.
(You need to do this everytime you want to use PuTTY without a password. If you logout you will need to do this next time you login. Once you logout PageAnt gets reset.)
  1. Open PageAnt (a new icon should apear in your system tray next to the clock)
  2. Right click on icon and select add key, and browse to private key
  3. enter the password you selected during key generation.
  4. hit OK.
5. To Test if it works correctly go Back to PuTTY
  1. Open up session you created above.
  2. It should connect with no issues. If there is an issue you did something wrong. Go back and check all settings above.
6. Add CVS_RSH system variable on Windows
  1. Right click on my computer and select properties.
  2. Find the enviornmental variables button and hit it.
  3. Add CVS_RSH as a system variable
  4. Name: CVS_RSH
  5. value: (path to plink.exe) (i.e. 'c:\putty\plink.exe')
  6. Hit OK,OK,OK.
7. Checkout CVS Module using SSH With Tortoise
  1. Create a project directory
  2. open up project directory in windows explorer
  3. right click and select 'cvs checkout'
  4. configure CVSROOT
  5. protocal = 'secure shell (:ssh:)'
  6. server= servername.domainname
  7. port = (blank)
  8. repository folder = (where cvs is installed on the server) (i.e. /usr/local/cvs)
  9. username = username for the server where cvs is installed
  10. module = name of module you want to checkout
  11. hit ok
  12. It should checkout all files into your project directory.
8. Configure CVSROOT using SSH for WinCVS
  1. Goto the Admin Menu and select Login
  2. Click on '...' next to CVSROOT at the bottom of the window.
  3. CVSROOT menu will pop-up
  4. Protocal: Select ssh
  5. Repository path : enter the path where the cvs repository is on the cvs server (i.e. /usr/local/cvs)
  6. Click on username and hit the edit button.
  7. Enter your username
  8. Click on hostname and hit the edit button.
  9. Enter the hostname or ip of the cvs server.
  10. click on private key and hit the edit button
  11. enter the path to your private key.
  12. ** Notice password,port and version are left empty
    • pageant saves the password so we don't need it here. If you are not going to use private keys then you can enter it.
    • port - we are using ssh so the default ssh port will be used, if you are using ssh on a non-standard port, you should put it here.
    • version - not sure what this is, so we are leaving it blank.
  13. Hit the OK button, it should bring you back to the login screen.
  14. Hit OK to login.
  15. It should log you in correctly, if not go back and check your settings.

9. Check out Module with WinCVS
  1. Go to the 'Remote' menu and select 'checkout module'
  2. try to check out your module.
  3. if it works then it is setup correctly.
You should now have TortoiseCVS or WinCVS setup to work through SSH using Private Keys.

Ken Cochrane