Ubuntu - file permissions getting changed automatically

2

1

I want to be able to update a certain svn working copy remotely through php. For that, I have given www-data user write permission to the .svn folder (It is owned by someuser:www-data, and I have set directory permissions to 775).

However, after sometime, permissions on the directory automatically get reverted back to 755.

1) What is causing this and how to fix this?

2) I am bit uncomfortable giving www-data user write permissions to the directory. Is there an alternate way?

tanon

Posted 2011-08-31T07:13:56.790

Reputation: 21

>

  • Most likely SVN itself. We cannot know with such little details. 2) Why don't you just execute svn update?
  • < – m0skit0 – 2011-08-31T07:23:33.987

    Cannot run svn update because it (svn update) needs to create .svn/lock file (for which www-data does not have permission) – tanon – 2011-08-31T07:47:56.317

    Answers

    1

    Regarding the first question, you probably want to setup auditd to monitor the directory for permissions changes:

    http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html

    How do I set a watch on a file for auditing?

    Let us say you would like to audit a /etc/passwd file. You need to type command as follows:

    # auditctl -w /etc/passwd -p war -k password-file
    

    Regarding your second question, it may be a better idea to give the www user sudo permission to another user to run the svn command alone, this way it can't write out random data there and if you want you could more closely control what it can do to the svn repo.

    polynomial

    Posted 2011-08-31T07:13:56.790

    Reputation: 1 424