Need help with File Locking in Linux

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
I have a group of students colaborating on a small webpage on my system, but right now they can easily (and have) mess up each others changes by having multiple people working on a file at the same time.
Is there any way I can implement a lock so that when one user opens a file (would it be application specific?) other users can not, or are at least informed that they are restricted to read-only?
I did a few searches, but everything on google is from odd forum-postings, and most of it pertains to 2.0 or 2.2.9 or earlier kernel's. I'm using Slackware 8*.
Also, Linuxdoc.org came back with 0 hits when I searched for 'file lock' or 'file locking'.

*almost because its a slack-current from about a month prior to the freeze

bart
 

Koeppster

Senior member
Jul 6, 2001
331
0
0
Check out this link. What you are looking for is a version control system. CVS might be beyond the scope of what you're doing, but tools exist to manage just the problem you describe.

Good luck.
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
Yeah we looked into cvs, but frankly that seems like overkill.
I just figured since *nix are and always have been multi-user systems that a feature like this would be a simple flag somewhere.

bart
 

DaHitman

Golden Member
Apr 6, 2001
1,158
0
0
Well... there is file locking (flock) but the problem comes with when people update... what if someone tries to update the file, but its changed since they last read it..

This actually is not a LINUX issue, this is a basic programming issue..

Your best bet is probably to setup CVS if this involves collaboritive programming... I have set up CVS and its darn easy really... And there are simple, easy to use web interfaces that slap right on top of it, so they could use a browser to check the files in and out...

Givin a little effort, you could come up with a long term solution.