Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Really appreciate your site. Really good site for learning what others do when they run into problems. You guy's are great!!!..."

Geography

Where in the world do Tek-Tips members come from?

File locking in Linux without changing permissionHelpful Member! 

vsdpsingh (Programmer)
16 Jan 12 0:55
Hi all,
I have some application, which is using some file, but if in between user deletes that backend file then application can start giving error.
How can i prevent user from deleting/cutting/renaming/blocking of usage by other applications that file.
Due to some issues i cannot change the premission of particular file.
In linux is there any command that can lock/unlock the file? So when application is using the file then, that file is locked for other applications?? OR just prevent user to cut/delete the file.
Please help me out
Thanks in advance
Annihilannic (MIS)
16 Jan 12 20:35
You could experiment with flock... I've never tried it myself; but I suspect it only works with other flock-aware applications... see how you go?

Annihilannic
tgmlify - code syntax highlighting for your tek-tips posts

Helpful Member!  tarn (TechnicalUser)
17 Jan 12 12:50
You need to get to the source of the problem and ask "why" does this other use have access to this file?

Do you not have access to the application configuration so that you can tell that app to put the file somewhere else so that this other user does not access the location of that file.

Assuming that this other user requires access to the file then you can provide a duplication of that file for this other user to access and destroy if he/she so wishes

Just ..

CODE

# tail -f <the_realfile.nnn> | tee -i /new/path/somenew_filename.nnn

Then let/tell this other user to access the copy not the source.

Good Luck.

Laurie.   
vsdpsingh (Programmer)
17 Jan 12 22:24
thank you all
@tarn this is a better idea to put the file somewhere else.
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close