Stop-a-file-from-being-deleted

Zip up a file to secure it from prying eyes. Place content on a USB device to hide it away. Put a file in the System32 folder to disguise it as just another system file. Rename a file to something less recognizable or interesting. These are all ways we attempt to keep things private. Whether it be photos or documents, we just don’t want people accessing them. We’ve looked at many ways to keep things more secure but in all these instances, the data can still be destroyed.

Some programs can claim the ability to stop a file from being removed but there is no true way to accomplish this because in every instance, the process can be diverted with a reformat or removal of the ‘protection’ software. Let’s look at what we can do to keep our important files clear being lost forever.

Deny security permission

One way to ensure no one but you can remove a file is to deny everyone else the default permissions.

Right-click the file, choose “Properties”, in the “Security” tab click “Edit” to change permissions and then select “Add” to enter “Everyone” in this field. Press OK and select the group to change the “Full control” permission to “Deny.” Press “Yes” on the confirmation prompt.

Change-all-security-permissions-to-an-explicit-Deny

Try to delete this file and a “File Access Denied” message is given. While this is evident in that we can’t remove the file, we still could go back and change the permissions for Everyone to have full access.

You-need-permissions-to-delete-a-file-with-explicit-Deny-modify-rights

If this file were on a network share or another user were to log in under the same computer, the file is undeletable for them, just as with me. What it comes down to is who can change the permissions back to the default of full access for everyone, thus granting the delete ability.

We see the owner of this file is the one who made it in the first place. Because I made this file, and I belong to the local Administrators group, I am the owner and only I can change the owner. As long as the owner of this file doesn’t change to Everyone, no one else but me can delete it.

View-the-owner-of-a-file-from-the-Owner-Security-tab

Use a program to disable file deletions

Delete-operations-are-not-clickable-with-Prevent

While this is a little more of an extreme solution, you can completely remove the right-click Delete and Cut options as well as the function of the keyboard’s Delete key with Prevent.

This works by defining an enable/disable hotkey that automatically prevents these functions. Open Prevent from the install folder (“C:\Program Files (x86)\Prevent\Prevent.exe”) to set this hokey, as a Start menu item isn’t created during install.

Define-a-hotkey-for-use-in-Prevent-to-enable-or-disable-the-delete-functions

The upside of this is that even a user logged in under your own account won’t be able to remove any file unless the hotkey is sent to exit the program. The downside, however, is that every cut, copy, paste, and delete function anywhere is disabled. This means when working with text as well.

Remember this program only disables these functions when the program is running. So again, if the program is uninstalled or a user under a different account or computer on the network will still be able to remove the file(s) at hand.

Final thoughts

As you’ve now noticed, a file can never truly be undeletable. A reformat, removal of the security software, or change in permissions can always bypass tricks like above. The best you can do is limit the scope of who can access or delete the content, which these two methods do well.

Download Prevent