Solved

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

Posted on 2011-03-16
7
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

739 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