Note: This information is now many years old and may no longer be correct. I'm leaving it here for any historical (hysterical?) value it may have. Use at your own risk, and if you break something, you get to keep both pieces.
- Install and configure sshd on the repository server. Make sure it works before proceeding.
Install Cygwin 1.1.x or later. You can get Cygwin here, or if you're in Australia , use AARNet's mirror here.
You will also need the following additional packages (URLs point to AARNet's mirror):
If you're part of an NT domain and normally logon using your domain account, make sure
/etc/passwd
was generated from domain accounts rather than local accounts. Do this before starting a shell for the first time, otherwise you will have problems with the permissions on $HOME, and in particular, $HOME/.ssh. If you create $HOME with local account information, then try to use ssh whilst logged on to the domain, it won't work. The only way out of this is to reboot, logon as an Administrator, delete $HOME and rebuild/etc/passwd
from domain accounts.mkpasswd
is the program which builds/etc/passwd
.The remaining instructions assume that you have installed Cygwin in "
c:\cygwin
". If you've installed it somewhere else, replace "c:\cygwin
" with the path to your Cygwin installation.Note: Cygwin uses Unix-style paths, and the root directory (`/') is the directory in which you installed Cygwin. For example, if Cygwin is installed in
c:\cygwin
, then the file/etc/passwd
is the same asc:\cygwin\etc\passwd
.Unix-style paths don't include drive letters. There are three ways to access other drives (or anything outside Cygwin's installation directory) from Cygwin:
- Use //drive/directory/file, for example,
d:\temp\temp.txt
can be accessed as//d/temp/temp.txt
. This only works on Cygwin prior to v1.3.3.- Use /cygdrive/drive/directory/file, for example,
d:\temp\temp.txt
can be access as/cygdrive/d/temp/temp.txt
. You can change the prefix using, for example,mount -s --change-cygdrive-prefix /
which will allow you to use/c/
to access your C: drive. The prefix change does not take effect until after the next reboot.- Mount the drive as you would under Unix. Not recommended for inexperienced users.
Get command line ssh working:
- Set the environment variable CYGWIN:
NT:Put this in $HOME/.bashrc so that it's set when you start a new shell.export CYGWIN="ntsec"
2000:export CYGWIN="ntea"
- You may need to force ssh to use protocol level 1, depending upon the configuration of sshd on the repository server. OpenSSH uses protocol level 2 by default. To change to level 1, edit
/etc/ssh_config
. If this file does not exist, create it. Find the line that contains:and change it to:Protocol 2,1If the line is commented out (a leading `#' character), uncomment it. If the line doesn't exist, add it.Protocol 1,2Make sure your home directory appears in your record in
/etc/passwd
. OpenSSH doesn't use $HOME, rather it reads your home directory from/etc/passwd
. Bash also reads your home directory from here, but it defaults to/home/username
if none is given (set in/etc/profile
). Records in/etc/passwd
look like this:The second-last field (delimited by colons) is the home directory, in this case,johnc::1000:513:John Clarke,S-1-5-21-...:/home/johnc:/bin/sh/home/johnc
. To use somewhere outside the Cygwin installation directory, use the /cygdrive/drive/directory convention.- Generate a key pair with ssh-keygen. Make sure you use a good passphrase.
- Put your key pair in
$HOME/.ssh
and set the permissions on the directory $HOME/.ssh to 700 and the permissions on the files within that directory to 600:chmod 700 ~/.ssh chmod 600 ~/.ssh/*- Send you ssh public key to the repository administrator.
- Once you've been notified that your public key has been installed on the remote server, open a bash shell and run the command:
Enter your passphrase when asked to do so. This should give you a shell on the server. Log off.ssh -l your_username repository_server- The repository administrator can restrict your access so that you can only run cvs, rather than a full shell, by inserting this:
command="/usr/bin/cvs -d repository_path server"before your public key in$HOME/.ssh/authorized_keys
. Read the sshd man page for more information on the format of this file.
Set the following environment variables in your bash shell:
The best place to put these definitions is in $HOME/.bashrc, so that they're set every time you start a shell.export CVS_RSH=ssh export CVSROOT=:ext:your_username@repository_server:repository_path NT: export CYGWIN="ntsec" 2000: export CYGWIN="ntea"
Now test command line cvs. Checkout a module from the cvs server using
cvs co
. You can then delete the working copy usingcvs release
.
Get and install WinCvs. There are two suitable versions, v1.1b17 and v1.20. Unless you really want to experiment with a beta release, get v1.20.
You can get v1.1b17 here and v1.20 here.v1.20 cannot handle ssh keys with passphrases, but this can be easily worked around by preloading the key using ssh-agent. This is more convenient anyway because it saves you from having to type your passphrase each time you do anything. You just need to make sure that you either remove the key or kill the agent if you leave your machine unattended, because once your key is loaded into ssh-agent, anyone with access to your keyboard can log on to any machine on which your public key is installed. The shell script below takes care of starting and stopping the ssh-agent automatically.
This step is optional if you're using WinCvs v1.1b17. You must do this if you're using WinCvs v1.20 and a key with a passphrase. WinCvs v1.20 does not allow you to enter a passphrase.
Create (or download) a bash shell script which contains:
#!/bin/sh if [ -z "$CYGWIN" ] then export CYGWIN="binmode ntsec" # change "ntsec" to "ntea" on Windows 2000 else export CYGWIN="binmode $CYGWIN" fi eval `ssh-agent` ssh-add $HOME/.ssh/identity /cygdrive/c/wincvs/wincvs.exe ssh-agent -k exit 0Adjust the path to WinCvs as necessary. Note the Cygwin-style path.
Make it executable. To do this, open a bash shell and run:
chmod +x wincvs.shCreate a shortcut which runs this script under bash, for example:
bash --login -c /cygdrive/c/cygwin/home/johnc/wincvs.shAlways start WinCvs 1.2 using this script.
Configure WinCvs as follows. Select Admin/Preferences and set:
CVSROOT: :ext:your_username@repository_server:repository_path Authentication: SSH Server Use version: CVS 1.10 (Standard)If you're using WinCvs v1.1b17 and didn't load you key with ssh-agent, check the "RSA identity" box and enter the name of your private key file. Do not do this if you're using v1.20 and using a key with a passphrase, load your key using ssh-agent instead (see below).
Select the "Globals" tab, enable " Enable TCP/IP compression" and set maximum compression (9).
Select the "Ports" tab, enable " Check for an alternate rsh name" and enter
c:\cygwin\bin\ssh.exe
.
Now it's time to test WinCvs over ssh.
Select Create/Checkout Module. Enter the module name you used earlier and the directory into which you want the module checked out, and then hit OK. If you're using WinCvs v1.1b17 and didn't load ssh-agent, enter your passphrase when prompted to do so. You should be rewarded with a complete working copy of the selected module.
That's it. You're now able to access the repository using either the command line cvs tools or WinCvs. It should be possible to use both on the same set of working files.
For those poor misguided souls who prefer to work from within Microsoft's Visual Studio, there's a plug-in available here which will give you a toolbar with buttons for the most common CVS commands.
As was necessary for WinCvs, you'll need to start Visual Studio from a bash script which first starts ssh-agent. Create (or download) a bash shell script which contains:
#!/bin/sh if [ -z "$CYGWIN" ] then export CYGWIN="binmode ntsec" # change "ntsec" to "ntea" on Windows 2000 else export CYGWIN="binmode $CYGWIN" fi eval `ssh-agent` ssh-add $HOME/.ssh/identity /cygdrive/c/Program\ Files/\ Visual\ Studio/Common/MSDev98/Bin/MSDEV.EXE ssh-agent -k exit 0Adjust the path to Visual Studio as necessary. Note the Cygwin-style path.
Make it executable. To do this, open a bash shell and run:
chmod +x msdev.shCreate a shortcut which runs this script under bash, for example:
bash --login -c /cygdrive/c/cygwin/home/johnc/msdev.shAlways start Visual Studio using this script.
If you're looking for a GUI front-end to CVS which runs on Unix, try TkCvs. I still prefer the command line, but TkCvs has one very nice feature - a graphical version tree.