Solved

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

Posted on 2011-03-16
7
358 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
awk file 6 99
Using Linux to replace Windows Server 2008 R2 for network drives 5 130
Disabling security updates Ubuntu 3 44
regular expression help for sed command 5 40
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,…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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