Freebsd – setting up svn on a FreeBSD server with SSH access

freebsdsvn

I'm not too familiar with this, and not a network administrator in general, but I am attempting to set up multiuser access to an svn repository on a local server.

So far I have installed subversion via

cd /usr/ports/devel/subversion
make install clean

Now I'm looking at how to configure and set up repositories and access. I have looked at the greatly useful SVN Book, however I'm looking for any examples/tutorials specific to FreeBSD.

The access to the respositories has to be via SSH.

Any advice would be appreciated.

Thanks.

Best Answer

Make sure you install the port with the svnserve wrapper enabled.

Note: Most--if not all--of the below commands must be executed as root.

Create an svn user group and add all the unix accounts you want to have access to it:

pw groupadd <group>
pw groupmod <group> -m <user>[,<user2>,...]

Then, create your repository:

svnadmin create /path/to/repos

Change its ownership to the group:

chown -R :svngroup /path/to/repos

Optionally, remove read-access from 'other' users:

chmod -R o-rwx /path/to/repos

And change permissions to allow group members sticky (append-only) access to the repository db:

find /path/to/repos/db | xargs chmod g+w
find /path/to/repos/db -type d | xargs chmod g+s

Test read access by ssh'ing as a user with svngroup membership:

svn info svn+ssh://user@host/path/to/repos

Test write access by creating your trunk dir (or whatever you want to call it):

svn mkdir svn+ssh://user@host/path/to/repos/trunk

You may be asked for your ssh password multiple times per svn command if you are not using key exchange.