I've set up a shared directory structure for users accessing a common set of files. Files created by a user are owned by that user (the group is inherited from the parent directory), so the team knows who to ask about new files. However, files modified by a user are not updated to reflect that user, so the team has no idea who created edits to a file.

I would like files edited by a user to automatically be chown'ed to that user.

The assets are already revision controlled, but I want the team to be able to tell who is making local edits to this shared sandbox, in between check-ins. In an ideal world, people remember to commit or clean up all changes, but nobody's perfect!


By "already revision controlled," I mean it's an svn checkout. We're not using filesystem tricks to implement our own type of revision control. For this particular case (I realize it wouldn't make sense in most cases), sharing the checkout, rather than everyone committing from their own sandbox and publishing changes, is the most productive.

  • What application creates the files? You might be able to make it create a new file and move it into place, rather than overwrite the existing file. – Gilles 'SO- stop being evil' Feb 27 '12 at 23:23
  • That would be reasonable (and in line with wingedsubmariner's suggestion), but the team will be doing ad-hoc editing of the files by command line or other ssh-connected editing apps. – Chris Betti Feb 28 '12 at 2:18

Take away group and other's write permissions on the files, but give them write permissions on the directories so that everyone can delete files. Then, when a user wants to modify a file, they have to remove the original file and write another in its place.

Alternatively, you could allow sudo chown (while not allowing sudo to be used for other commands). This would force users to take ownership before editing.

| improve this answer | |

It seems quite weird to use filesystems that way, they are not really made for revision control and collaborative work.

Anyway, I guess you can make something with inotify. There is a IN_MODIFY event which indicates when your file was modified.

You can either use tools like inotify-tools or make your own little program with the C-API.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.