I just setup a new subversion server, but I couldn’t get any of my clients to commit or import new data into the repository. The clients were getting the error message:
svn: Commit failed (details follow):
svn: Can’t create directory ‘/svn/repos/project/db/transactions/1-1.txn’: Permission denied
And the error logs gave me the error:
[Wed Feb 21 15:33:14 2007] [error] [client 10.0.0.1] Could not create activity /project/!svn/act/9daeeb55-032a-0410-afe1-c75d3611fb5b. [500, #0]
[Wed Feb 21 15:33:14 2007] [error] [client 10.0.0.1] could not begin a transaction [500, #13]
[Wed Feb 21 15:33:14 2007] [error] [client 10.0.0.1] Can’t create directory ‘/svn/repos/project/db/transactions/1-1.txn’: Permission denied [500, #13]
All of the websites referred to making sure the ‘apache’ user had ownership of the repository files, so the server could write the files. I had already done this, but it still wouldn’t write to the server. Then I found the following details at http://subversion.tigris.org/faq.html#reposperms
Note for SELinux / Fedora Core 3+ / Red Hat Enterprise users:
In addition to regular Unix permissions, under SELinux every file, directory, process, etc. has a ’security context’. When a process attempts to access a file, besides checking the Unix permissions the system also checks to see if the security context of the process is compatible with the security context of the file.
Fedora Core 3, among other systems, comes with SELinux installed by default, configured so that Apache runs in a fairly restricted security context. To run Subversion under Apache, you have to set the security context of the repository to allow Apache access (or turn off the restrictions on Apache, if you think all this is overkill). The chcon command is used to set the security context of files (similarly to how the chmod sets the traditional Unix permissions). For example, one user had to issue this command
$ chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
to set the security context to be able to successfully access the repository.
Now everything works great.