41

I have just set up svn on my ubuntu server. I have a my user I can login to. The problem is that whenever I try to make a change on the file structure I get a permission denied error.

Can't open file '/var/www-svn/db/txn-current-lock':
Permission denied

My repo is in /var/www-svn and the permission on that folder is drwxr-xr-x for user AND group svn (I am bad with permissions so I don't know if that's correct). My user that I log in to on svn is in the svn group, yet I cant change the file structure. What am I doing wrong? It works if I change the user and group of the folder to my user that I login too.

In svnserve.conf, anon-access is set to none and auth-access is set to write.

(I changed the owner of /var/www-svn by typing sudo chown -R svn:svn www-svn inside /var directory.)

Marwelln
  • 28,492
  • 21
  • 93
  • 117

10 Answers10

31

Repository folder on file system must be owned or at last to have read/write permission by the same linux user that your svn or apache via web-dav is working on...

In my case it was:

$ chown -R www-data:www-data /svn/reponame

But in some other case, it might be different, like

$ chown -R someuser:somegroup /svn/reponame

So replace someuser:somegroup with proper values.

Aleksandar Pavić
  • 3,143
  • 1
  • 34
  • 36
11

You have to add the SETUID bit for the /var/www-svn/ folder, cause under transactions there will be folders generated during the run of SVN for preserving transactions which are represented by folders.

This means in short words just make

chmod +s -R /var/www-svn/

should solve the problem.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
7

The svnserve deamon ran under my user, not as root. I killed the svnserve processes running under my user and restarted it as root. It now works.

Marwelln
  • 28,492
  • 21
  • 93
  • 117
6

My problem ended up being that I applied permissions, then did svnadmin create so setting permission was needed again.

 $ sudo chown -R www-data:subversion myproject
 $ sudo chmod -R g+rws myproject
Marwelln
  • 28,492
  • 21
  • 93
  • 117
3

It seems a question for superuser.com. At first sight, group svn doesn't have write permission on that folder. So maybe is this the problem.

Link not working anymore, see comments for a quick solution Take a look at this http://www.svnforum.org/threads/35493-Can-t-open-db-txn-current-lock-permission-denied

Simone-Cu
  • 1,109
  • 8
  • 21
2

In case you don't have sudo rights:

In my particular case I was migrating from one shared Webfaction server to another. Copying the files must have assigned the whole repository ownership to my username while the owner probably should be apache in order for the repo to be accessible. I could not apply any chown apache:mygroup repo because I don't have access to the user apache. Without having root access the only way to make it work was chmod -R 777 . inside my repository root, eventually deleting a lock file to which I had no permissions to chown. That finally solved the issue and I could commit again.

flaudre
  • 2,358
  • 1
  • 27
  • 45
2

Permission with Read and writes missing for the repo created.

chcon -R -t httpd_sys_rw_content_t /path_to_svn Ex: chcon -R -t httpd_sys_rw_content_t /opt/svn/trunk

Sadashiv
  • 53
  • 5
  • Had this issue on CentOS 8 with svn setup through apache httpd ( used this guid: https://computingforgeeks.com/install-apache-subversion-svn-on-centos-rhel-8) . this solved the issue. thanks :) – Ali Oct 13 '20 at 08:33
0

Last but not least, if your repository is owned by user and group svn

(sudo chown -R svn:svn /var/svn/repos)

Be sure to add the users who can access it to the svn group. vi /etc/group

svn:x:502:user1,user2
im3r3k
  • 503
  • 1
  • 7
  • 14
0

Though the question is very old, it ranks higher on Google, but one with subversion on Apache / httpd on Linux do not find the solutions helpful.

I'm running subversion on Apache, CentOS linux. For me the problem was due to SELinux and disabling that helped me.

It requires caution before doing this as it might not be recommended on a production server to disable the SELinux. Please read well the documentation before attempting to do so.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Enabling_and_Disabling_SELinux-Disabling_SELinux.html

As Stewart suggested in the comment, another solution is by updating the file permissions, though more details are unavailable, some tweaking around with file permissions should help.

Pavan Kumar
  • 4,182
  • 1
  • 30
  • 45
  • The posted link is broken. Why could you not have just posted the answer here directly? This is why "link only answers" are frowned upon. Now we'll never know .... – Stewart Apr 30 '17 at 06:42
  • 1
    @Stewart Sorry that the link is down. Does not seem like it could be recovered using search engine cache or archive.org. To best I remember, the issues with SELinux have been resolved by disabling it. Try doing the same and let know the results. Be a little cautious and read well before performing such action on a PROD server. – Pavan Kumar May 03 '17 at 05:36
  • I fixed the issue by changing file ownership in the end. – Stewart May 03 '17 at 06:49
  • On CentOS , instead of disabling SeLinux which is not recommended at all. try using the fix above by @Sadashiv . it worked for me – Ali Oct 13 '20 at 08:35
0

Restart Eclipse IDE.

I had the exact same case and failed during the try to commit changes using EclipseIDE.

While Eclipse was running I changed the groups of the user who like to commit to the repository.

Supprisingly I noticed that as soon as I restarted Eclipse the modified group/rights of the repository was granted. I think that Eclipse keeps a ssh-channel open and during the ssh-channel-session the modified grouprights are ignored.

During eclipse-restart the ssh-session is recreated and the modified group-rights are sticked to the new ssh-session granting the commit.

Grim
  • 1,938
  • 10
  • 56
  • 123