How to run CVS with SSH under Windows 9x/NT/2000:
This technical note assumes you don't have Cygwin running already. If you do, then the later versions all come with OpenSSH installed, making acquisition of SSH binaries unnecessary. The note's main target audience is MS-Windows users trying to work with SourceForge, but the technique can be extended to other CVS uses.
Required Software
First you need to download two things:
The SSH binaries for Windows. These must be SSH version 1. Although there may be other versions out there, the binaries in the file ssh-1.2.14-win32bin.zip are perfectly adequate for the task. They will allow you to generate ssh key pairs, run ssh, and run scp. This file can be found at:
ftp://ftp.funet.fi/pub/unix/security/login/ssh/contrib/ssh-1.2.14-win32bin.zip
The latest version of WinCVS — this can be found at http://www.wincvs.org . Note that WinCVS is an optional (graphical) enhancement to the basic command-line setup. There are a number of alternative graphical shells and graphical CVS-replacements, including TortoiseCVS, CvsIn, Jalindi Igloo, CVS SSC proxy, jCVS, TkCVS, SmartCVS, Eclipse, and others.
Installing SSH:
First of all, create a directory. (I will useC:\SSH
for this example.) Then,
unzip all the files in ssh-1.2.14-win32bin.zip
into it.
You now need to add your directory to your path, and set up an environment
variable called HOME
, as follows:
Windows 95/98:
Modify your AUTOEXEC.BAT
file (stored in C:\
), as follows:
Add the lines:
SET HOME=C:\SSH
SET PATH=%PATH%;C:\SSH
Now restart your machine.
Windows NT4:
Open "Control Panel", then the "System" icon. Click on the tab marked "Environment".
In the Variable box at the bottom of the window, type in
HOME
.
In the Value box underneath, type in C:\SSH
.
Click the "Set" button.
Then find the variable called PATH
in the User or System Variables boxes above, click on it, and modify it as follows:
To the end of the PATH
value, add a semicolon and then your SSH directory
(e.g., ;C:\SSH
).
Click the "Set" button.
You must now close and re-open any DOS windows that you have open.
Windows 2000:
Open "Control Panel", then the "System" icon. Click on the tab marked "Advanced", and then on the Button marked "Environment Variables".
Click on the "New" button in the top, User Variables window.
In the Variable name box, type in HOME
.
In the Variable Value box underneath, type in C:\SSH
.
Click the OK button.
Then, find the variable called PATH
in the User or System Variables boxes above,
click on the "Edit" button, and modify it as follows:
To the end of the Variable Value, add a semicolon, and then your SSH directory
(e.g., ;C:\SSH
).
Click the "OK" button.
You must now close and re-open any DOS windows that you have open.
Generating an SSH Key
Type ssh-keygen -C "user@hostname"
You can put a comment about your key in-between the quotation marks, if you
like. Note: You must include the -C flag, as otherwise ssh-keygen
will
not produce a key pair. The default comment is user@hostname, but, without the
Cygwin tools installed, ssh-keygen
will not be able to figure out your hostname.
Once it has generated a key, it will print out:
Enter file in which to save the key ($HOME/.ssh/identity):
Just hit Return
, as this is where you want the keys saved.
You will then be asked for a passphrase.
If you do choose to enter a passphrase, then enter it, and then confirm it.
If you are happy that your computer is secure, then hit Enter
twice to ignore
this. This makes using SSH much more convenient, but does mean that if your
machine is compromised or if others can log onto your computer, then they can
also SSH to anything you can.
SSH is now installed!
N.B. To log into a server with your keys, a line must be added to the
authorized_keys
file in the same directory, that consists of the text contained
in the identity.pub
key file. (See below, if you need to do this yourself).
Often a system administrator will do this for you, if you e-mail the admin your
identity.pub key file (stored in C:\SSH\.ssh
). Make sure you do not e-mail the
"identity" file, as this is your private key.
Setting up WinCVS:
Download and Install WinCVS from the link above. This is done by extracting the
files to a temporary directory, and then running Setup.exe
. Once Installed,
run WinCVS, and set up as follows: Click on the "Admin" menu, and
choose "Preferences" under the "General" tab. Enter the
address of the CVS server into the CVS Root box.
This should be in the format:
username@cvs.smaug-web.sourceforge.net:/cvsroot/smaug-web/
...where username is your given username, and where we're using the "smaug-web" project on SourceForge as an example.
Now, in the drop-down Authentication box below, select "SSH server".
Tick the "RSA Identity" box, and then type the exact location and
name of your private key (e.g. C:\SSH\.ssh\identity
). Click on the
"Ports" tab, and tick the box marked "check for an alternate
rsh name". In the box next to this, enter the exact location of your SSH
program file (e.g., C:\SSH\ssh.exe
).
Click on the "WinCVS" tab and then click the "Change
Folder" button under "Home Folder". Select the location of
your .ssh directory (e.g., C:\SSH\.ssh
).
WinCVS should now be configured to use SSH!
To test it, go to the "Admin" menu and select "Command
Line". Type in "cvs co -c
". WinCVS should now connect and give you a
listing of all the available modules for download.
N.B.: This will only work if the CVS server already has your public key listed
in its authorized_keys
. You can do this by viewing your SourceForge
account options. Click [Edit Keys], and then paste the contents of the
identity.pub
file into the text box. The authorized_keys
file is updated every
6 hours, so you may have to wait a while after entering your new key, before you
gain access to the CVS server.
In the meantime, if you try to execute any CVS commands, a window will open with
the title C:\SSH\ssh.exe
. Simply type your password in this box, and press
Enter
. Unfortunately, there is no prompt, and no keystrokes are echoed. This
is temporary, until your authorized_key
file is edited.
Now, you should be able to use WinCVS as above.