Hack, Build & Scale - Web & Server apps

Hack, Build & Scale - Web & Server apps

How to Protect Files From Deletion in Windows

How to Protect Files From Deletion in Windows

R Sharma (WorldOfHacker)'s photo
R Sharma (WorldOfHacker)
·Sep 23, 2013·

3 min read

Subscribe to our newsletter and never miss any upcoming articles

Play this article

No one among us knowingly Delete important files in their hard disk but some times it may happen accidentally........and then start :-( :sad: about it........now i am posting a way to prevent them from getting deleted accidentally. This can be done in an NTFS partition by setting appropriate access permission to that file or folder. This article will show you how to do that.

Method 1: Protect all files within a folder
The NTFS file permission dictates that users who are granted Full Control on a folder can delete any files in that folder regardless of the permissions that protect the file. Hence to protect files in a folder from deletion, it is essential to deny Full Control on that folder. Once that permission is revoked, all files within that folder are automatically protected from deletion without having to set permission for each file individually. The steps required to do this is described below.

1. Create a folder on the root of an NTFS formatted hard drive partition. If the folder which you want to protect already exist and is nested several folders deep, it is recommended to move this folder to the root of the partition.

2. Right-click on the folder and choose Properties.

3. Click on the Security tab and then click Advanced.

4. Click Change Permission, and on the next window highlight Administrator and click Edit

[Image: capture2ur.png]
[Image: capture3d.png]

5. Under Permission settings, check the boxes “Delete subfolders and files” and “Delete” under the Deny column.

[Image: capture4dj.png]

6. Click OK on all opened windows until you have closed them all.

The folder is now protected. Under this folder you can create new files or edit existing files but you cannot delete them or rename them. Attempting to do so results in this File Access Denied message.
[Image: capture5e.png]

Method 2: Protect only selected files
This is somewhat difficult to achieve for reasons already explained – users who have full access to the parent folder can delete files regardless of the permissions that protect the file. So even if you deny Delete access to a file, if the parent folder is set to Full Access the user will be able to delete the file all the same. But there is one way by which we can workaround this problem.
1. Right-click on the file you want to protect and choose Properties.

2. Check the attribute “Read-only” and click Apply.

[Image: capture6e.png]

3. Open the Security tab and click Edit.

4. Highlight the user name Administrator and check the box “Write” under the column Deny.

[Image: capture7s.png]

5. Click OK on all windows to exit.

The file now cannot be deleted, but it cannot be edited or modified too. That’s an undesirable consequence of selectively protecting files.

Alternative Method: Use third party software:

If working with file permission is too much for you, you can try System Protect – a freeware that prevents deletion of important system files as well as user-selected files. The program runs in the background just like an anti-virus program do and continuously monitors all access to the protected files. If any process tries to delete the files the user is alerted. The program can be configured to automatically deny all delete attempts or ask the user for action. Additionally, System Protect allows files and folders to be password protected.

[Image: systemprotect5b35d.gif]

Did you find this article valuable?

Support Hack, Build & Scale - Web & Server apps by becoming a sponsor. Any amount is appreciated!

See recent sponsors Learn more about Hashnode Sponsors
 
Share this