For those of us still using CVS, rather than the highly acclaimed subversion, I wanted to outline a solution to a common problem I’ve often seen:
One user creates a cvs module (named, for example, project) and checks in a number of files and directories. Then another developer tries to check out the module and sees this error. (Here’s another explanation of the solution.)
: cvs checkout: failed to create lock directory for
`/usr/local/cvsrepo/project'
(/usr/local/cvsrepo/project/#cvs.lock): Permission denied
: cvs checkout: failed to obtain dir lock in repository
`/usr/local/cvsrepo/project'
: cvs [checkout aborted]: read lock failed - giving up
If you go to /usr/local/cvsrepo/project
, and run an ls -l
, you’ll see that the permissions look like:
...
drwxrwxr-x 2 user group 4096 Feb 16 09:40 bin
...
This error message comes from the fact that the second user is not a member of group group
. The best way to solve this is to create a second group, perhaps called cvs
, and assign both users to that group.
Then, you want to make sure that all the files have the correct group bit set:
chown -R :cvs /usr/local/cvsrepo/project
And, you want to make sure that any new directories (and files) added use the cvs
group, rather than the group
group:
chmod -R g+ws /usr/local/cvsrepo/project
Your final permissions should look like:
...
drwxrwsr-x 2 user cvs 4096 Feb 16 09:40 bin
...
Now the second user and any other developers should be able to check out the code so safely stored in cvs.