Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
How to deny delete/modify permission to a file?

The story is pretty simple:

  1. I'm an administrator.

  2. To prevent accidental deletion of a file, I have denied all permissions to everyone for this file (it's on an NTFS volume).

  3. The computer doesn't seem to care -- Shift+Del, the del command, etc. still delete the file just as they did before. Programs have trouble opening the file, but not deleting it!

Why am I not being denied permissions to delete the file?!

Screenshot

share|improve this question

marked as duplicate by Karan, soandos, Diogo, ChrisF, CharlieRB Oct 29 '12 at 12:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Are non-admin users allowed to delete the file? –  Karan Oct 29 '12 at 6:39
    
@Karan: I'm not sure, I'm the only user on my computer. But if I launch a command prompt with "limited permissions" then I can't delete the file at all, irrespective of whether or not I've explicitly denied these permissions. Would you like me to try creating a new user? And if so, then what permissions should I set on the user, and on the file? –  Mehrdad Oct 29 '12 at 6:43
    
Is that screenshot from Win7? Also, this scenario might be covered already by How to deny delete/modify permission to a file? –  Karan Oct 29 '12 at 6:55
    
@Karan: Yes, it's from Win7 (with a different visual style). I'll take a look at that link, thanks. –  Mehrdad Oct 29 '12 at 6:57
add comment

2 Answers

up vote 1 down vote accepted

You need to deny write permission on folder to everyone then it will be not possible to delete a file.

share|improve this answer
    
On the folder? But I only want to prevent deleting this file, not any other file... –  Mehrdad Oct 29 '12 at 6:49
2  
because the deletion/creation is an operation on folder, not on a file –  Serge Oct 29 '12 at 6:51
    
Hmm... but when I run Process Monitor, it shows a CreateFile operation on the file, followed by SetDispositionInformationFile with Delete: True (which I presume corresponds to FILE_DISPOSITION_INFORMATION). It doesn't seem to have to even open the folder at all during deletion... how is this an operation on the folder? –  Mehrdad Oct 29 '12 at 6:54
    
because it has to delete the record about your file from the folder. not from the file. This is why it has to write to a folder (that is actually also a file, just with special meaning) –  Serge Oct 29 '12 at 6:58
    
CreateFile function does not always create a file. Its name a bit misleading. I would name it CreateFileHandle –  Serge Oct 29 '12 at 7:00
show 9 more comments

When you create a file it belongs to a specific folder therefore you need to set the permissions for the parent folder of that file.

You should try denying permissions to the parent and then i believe you wont be able to delete the file.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.