I want to deny myself the ability to modify or delete an executable.

When .NET Reflector asks you if you want to update:

enter image description here

and you choose No it spontaneously deletes itself as retribution:

enter image description here

So I want to prevent myself from being able to Delete the executable; as punishment for their punishment.

I tried to Deny me Write permission (and deny it to Everyone, and Administrators):

enter image description here

Except, I can still Right-Click -> Delete the file...

How do I deny the delete/modify permission to a file?

link|improve this question

71% accept rate
Yeah, write access has nothing to do with delete permission. This seems like a rather draconian way to solving this problem. – surfasb Jul 12 '11 at 18:33
i'm surprised at a downvote. i would think being able to stop something from modifying your files would be a useful question. – Ian Boyd Aug 29 '11 at 23:12
@surfasb Write access very well may have nothing to do with delete. i only include things i've tried because some people get grump when i simply ask the question. And some people will give spiteful downvotes if i don't "show research effort". – Ian Boyd Jan 15 at 15:12
feedback

1 Answer

up vote 2 down vote accepted

On Windows, it is enough to have one of "Delete" on the object or "Delete child" on its parent, therefore a file will only become undeletable if you deny both.

Use icacls to edit the permissions:

  • Deny "Delete" to the file:

    icacls Reflector.exe /deny Everyone:(D)
    
  • Deny "Delete child" to the folder:

    icacls . /deny Everyone:(DC)
    

(Tested on Windows XP.)

link|improve this answer
Denying Modify permission also removes Execute permission; and i can still delete the file! – Ian Boyd Jul 12 '11 at 18:38
As I said, "You may also have to deny "Delete items" on the folder"... Which too can be done with icacls. – grawity Jul 12 '11 at 20:39
On the downside that would deny the ability to delete other items in the folder. Given that it doesn't seem to be working, i presume it is not possible to deny the ability to delete a file - deletes must happen against folders, rather than files. – Ian Boyd Jul 13 '11 at 2:25
Edit your answer to indicate that it cannot be done, "But here are some alternatives that might be useful", and you'll get the accept. – Ian Boyd Jul 13 '11 at 2:25
@Ian: Of course. I have done that. – grawity Jul 13 '11 at 6:18
feedback

Your Answer

 
or
required, but never shown

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