Solved

How to restrict Multiple user edits to single file from multiple session in linux.

Posted on 2011-03-16
7
346 Views
Last Modified: 2012-05-11
I want to restrict multiple user edits to single file from multiple session in linux, how can i do this ??
0
Comment
Question by:sudhirgoogle
7 Comments
 
LVL 10

Expert Comment

by:abbright
ID: 35147050
Create a new group called "editfilegrp".
Put the users you want into this group.
Then change group-ownership of the file to this group: chgrp editfilegrp filename
Change permission to edit the file only for this group: chown u-w,o-w filename
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 275 total points
ID: 35147227
I'd suggest using some kind of source code control system or revision control system.

Mandatory file locking cannot be implemented without programming (C, maybe Perl), taking the original editor binary out of reach, and cooperative/advisory locking (e.g. by some wrapper script to the editor call) is easy to circumvent (just use the original editor binary instead of the wrapper script).

Wikipedia has a list of free revision control software:

http://en.wikipedia.org/wiki/Category:Free_revision_control_software

wmp

0
 
LVL 3

Accepted Solution

by:
Alberto Cortes earned 225 total points
ID: 35148772
Solution:

What you need is a Revision Control environment, where you have control of the file changes and can revert if needed.
I suggest you to check commercial products like IBM Clearcase, or free product like Apache Subversion:
http://en.wikipedia.org/wiki/Clearcase
http://en.wikipedia.org/wiki/Subversion_%28software%29
 
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 40

Expert Comment

by:omarfarid
ID: 35151396
how the file is edited?
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35154197
Thanks for your response. The is being edited using VI editor or VIM
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 275 total points
ID: 35155770
Neither vi nor vim provide a locking mechanism.

Since I assume that you're not willing to write a C program, without Revision Control your only option is a wrapper script to vi and vim providing some kind of locking.

The obvious drawbacks here are:

- Easy circumvention by using the original binary. There is no support for setuid scripts in Linux and most Unixes (except Solaris).
- Easy manual removal of lock files. The concerned user must have full read/write access to them.
- Orphaned locks. Even when trapping all possible signals you can't completely avoid leaving orphaned locks which must be removed manually.
- Ambiguity. Either you're going to lock the filename alone, then only one single file with that name can be edited at a time system-wide, regardless of which directory it is in, or you're going to lock the full path, then a simple cd to the respective directory and starting vi against the filename alone would circumvent the lock.

wmp
0
 
LVL 1

Author Closing Comment

by:sudhirgoogle
ID: 35735761
Not able to implement.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now