Setting up a CVS server via SSH

without offering a shell access. Here is a quick recipe that uses:

#1 Choose a machine with

The instructions below assume a unix like operating system.

#2 Create a local user (say projectcvs)

The disadvantage of using one user ("projectcvs") is that the author in the logs is always the same. One way around is to set up as many users as necessary on the server and grant them access to the CVS repository using group permissions.

#3 Create a cvs directory

#4 Set up the ssh infrastructure

#5 Add ssh keys

Add each ssh public key in $HOME/.ssh/authorized_keys on one line with the following model.

command="/path/to/cvs server",no-port-forwarding,no-pty,no-X11-forwarding,no-agent-forwarding ssh-rsa AAAA<...>jQaqs= foo@bar

(see 'man sshd', section 'AUTHORIZED_KEYS FILE FORMAT')
The above line grants access for the user having the associated private key. The only usable command is "/path/to/cvs server", which provides a reasonably good safety level.

The cvs option --allow-root=/path/to/cvsrepo is not be honored with the ":ext:" access method and, therefore cannot be used (unless patching cvs on the server, see http://ioctl.org/unix/cvs/server).

#6 Test the cvs connection

Logged as a different user whose public key has been entered as above, the access is done using:

env CVS_RSH=ssh cvs -d:ext:projectcvs@host.xx.yy.zz:/path/to/cvs_directory checkout .

The "-d" option can be omitted once a snapshot is obtained as cvs will find the relevant information stored in the local directory CVS. However, CVS_RSH must still be set.

Starting cvs 1.12.11 on the client side, one can use a new syntax, a welcome addition to avoid forgetting setting CVS_RSH. I did not try it though.

env CVS_RSH=ssh cvs -d:ext;CVS_RSH=/path/to/ssh:projectcvs@host.xx.yy.zz:/path/to/cvs_directory checkout .

#7 A few tips about CVS

Information about using CVS is available at http://www.cvshome.org. The cvs manual is available at http://www.cvshome.org/docs/manual/.

Some particularly useful commands are:

References

$Id: CVSserver.html,v 1.5 2005/01/14 12:12:56 arnaud Exp $

by Arnaud Desitter.
© Arnaud Desitter 2005