Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create a file that cannot be copied?

Tags:

windows

To restrict the scope, let assume we are in Windows world only.

Also assume we don't want to play with permission policy.

Is it possible for us to create a file that cannot be copied?

Thank you in advance.

like image 595
xport Avatar asked Jul 29 '10 12:07

xport


People also ask

Why do some files not copy?

Your “copy-paste not working in Windows' issue may be caused by a temporary glitch, software interference, device drivers, or a corrupted system file, etc. For some people, the Copy and Paste options are grayed out in the right-click context menu, and the keyboard shortcuts (Ctrl+C and Ctrl+V) do nothing.

What does it mean properties Cannot be copied?

What does it mean when a file cannot be copied with its properties? Copying or moving a file without some of its properties from an NTFS drive to a FAT drive will simply mean that the properties will be lost, whereas the file will remain intact and functional.

Can you copy a file that is being written to?

Either: The file will be locked and nothing will happen. It may crash your script if you don't have decent error handling. A copy of the file will be made in the state it was in at the instant the copy was initiated.


11 Answers

No. You can't create a file that a SYSADMIN can't copy. You could encrypt it, though.

like image 181
Pablo Santa Cruz Avatar answered Oct 13 '22 22:10

Pablo Santa Cruz


"Trying to make digital files uncopyable is like trying to make water not wet." ~ Bruce Schneier

like image 30
mocybin Avatar answered Oct 13 '22 22:10

mocybin


Any file that can be read can have its contents written to another location (such as another file, i.e. copied).

The only thing you can do is limit who/what can read the file.

like image 21
Drew Noakes Avatar answered Oct 13 '22 22:10

Drew Noakes


What is the motivation behind? If it is a read-only file, you can have it as embedded resources within your assembly.

like image 21
Fadrian Sudaman Avatar answered Oct 13 '22 20:10

Fadrian Sudaman


Well, how about creating a file that uses up more than 50% of the total space on that machine and that is not compressible? For instance, let us assume that you want to save a boolean (true or false) in such a fashion. Depending on its value, you could then write a bit stream of ones or zeroes and encrypt said stream using some kind of encryption algorith, such as AES in CBC mode. This gives you the added advantage of error correction. Even in case of massive data corruption, you should be able to recover your boolean by checking whether ones or zeroes are prevalent in the decrypted stream. In that case you cannot copy it around (completely) on the machine... Of course, any type of external memory that can be added to the system would pose a problem in this scenario. But the file would be already encrypted, so don't worry about it too much...

like image 33
SoundAdvice Avatar answered Oct 13 '22 22:10

SoundAdvice


Nice try, RIAA.

But seriously, no you can not. It is always possible to copy, you can just make it it more difficult for people to make sense of the file or try to hide it using like encryption. Spotify does it.

If you really try hard thou, you cold make a root-kit for windows and use it to prevent windows from even knowing about the file and also prevent copies. The file will still be there and copy-able by other tools, or Linux accessing the ntfs.

like image 26
rapadura Avatar answered Oct 13 '22 22:10

rapadura


If in a running process you open a file and hold an exclusive lock, then other processes cannot read the file until you close the handle or your process terminates. However, as admin you could forcibly remove the lock handle.

like image 34
Daniel Rose Avatar answered Oct 13 '22 20:10

Daniel Rose


Short answer: No.

You can, of course, use security settings to limit who can read the file. But if someone can read it, then they can copy it. Even if you found some operating system trick to disable "ordinary" copying, if someone can read the file, they can extract the contents, store it in memory, and then write it somewhere else.

You can encrypt the contents so it's only useful to your own program, that knows how to decrypt it.

That's about it.

like image 21
Jay Avatar answered Oct 13 '22 22:10

Jay


When using Windows 7 to copy some files from a hard drive, certain files popped up a message saying they could not be copied in their entirety; certain data would be omitted from the copy. I suspect that had something to do with slack space at the end of the files, though I thought the message was curious. I would have expected the copy operation to just ignore the slack space.

like image 32
supercat Avatar answered Oct 13 '22 21:10

supercat


If you are running old (OLD) versions of windows, there are certain characters you can put in the filename that make it invalid, not listed in folders, etc. They were used a lot in the old pub ftp days of filesharing ;)

like image 20
Wes Avatar answered Oct 13 '22 21:10

Wes


In the old DOS days, you used to be able to flag disk sectors as bad and still read from them. This meant the OS ignored the sector in question but your application would know where to look and be able to get the data. Not sure this would work these days.

Another old MS-DOS trick was to put a space character in the middle of the filename (yes, spaces were valid characters for filenames). Since there was no method on the command line to escape a space, the file couldn't be copied using the DOS commands.

like image 31
Skizz Avatar answered Oct 13 '22 20:10

Skizz