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