Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
P is for Practical
 
PerlMonks  

Re: How to let perl knows if somebody copies a file

by MidLifeXis (Prior)
on Jun 28, 2012 at 12:20 UTC ( #978905=note: print w/ replies, xml ) Need Help??


in reply to How to let perl knows if somebody copies a file

It sounds like you want to trap the system calls (section 2 in the man pages, not section 1) that can be used to copy a file, or else there are ways that you can go around whatever you set up. While it is possible, it can be difficult to do right and without significant system resources devoted to this function.

Would hard linking to a file that gets modified by a program that saves to a new file and then renames be a method to copy a file? Sure. Hard linking doesn't require the open(2) call.

If you can restrict access to the ability to write the file, it may be easier. passwd, for example, is a program that restricts edit capabilities to the system password database, and (at least in theory) only allows reasonable changes to be made.

Perhaps if you were to provide a bit more information as to what you were trying to achieve, a reasonable solution to your task could be proposed. For example, are you trying to stop a file from being copied from, or copied to? If trying to restrict copying to, perhaps a process where any change not coming from a signed commit in a source management system (git for example) gets overwritten by the latest signed commit.

--MidLifeXis


Comment on Re: How to let perl knows if somebody copies a file
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2013-05-19 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (397 votes), past polls