Previous Section  < Day Day Up >  Next Section

Recipe 18.9. Creating a Shared CVS Repository

18.9.1 Problem

CVS is nice for tracking your own files, but in the real world teams of people usually work together on projects. How do you set up a CVS repository that's shared by a group of users?

18.9.2 Solution

First create a CVS owner and group; these will own the repository. Then create the repository:

# groupadd cvsusers

# useradd -g cvsusers -u 105 cvs

# mkdir /cvsroot

# chown -R cvs /cvsroot

# chmod -R 770 /cvsroot

# cvs -d /cvsroot init

# chgrp cvsusers /cvsroot

# chmod g+s /cvsroot

Add users to the cvsusers group to give them access.

Now any user in the cvsusers group can import a project into the repository. This example adds the techbook project:

$ cd /techbook

$ cvs -d /cvsroot  import  techbook  cups_howto version_1

The new project will be owned by the person who imported it, and the cvsusers group:

$ stat /cvsroot/techbook

File: `techbook'

  Size: 136             Blocks: 1          IO Block: 4096   directory

Device: 306h/774d       Inode: 69624       Links: 2

Access: (2775/drwxrwsr-x)  Uid: ( 1000/   carla)   Gid: ( 1005/cvsusers)

18.9.3 Discussion

The commands in this recipe must be run on the CVS server. See Recipe 18.11 to learn how to access a remote repository.

It's important to follow the above command sequence, to get the permissions correct. cvs init creates a large batch of administration files, with its own set of permissions, so you don't want to change them. (You can view them in the CVSROOT subdirectory.)

When you're creating a system or daemon user, remember to assign an appropriate UID (see Recipe 8.2, Recipe 8.2).

You should set all users' umask values to 007 to eliminate any kind of world access to the CVS repository files. Just add this line to everyone's ~/.bashrc:

umask 007

Setting the sticky bit restricts removing or renaming of files to the file owners, the group owners, or the superuser.

18.9.4 See Also

  • Chapters 2 and 6 of Essential CVS

  • Local documentation—"The Repository" (/usr/share/doc/cvs/html-info/cvs_2.html)

  • CVS home page (https://www.cvshome.org)

    Previous Section  < Day Day Up >  Next Section