Friday, 15 November 2013

NTFS permissions , Read-Write-Modify but can't delete .

Guys,
We had a situation where we had to provide read/write permission on root folder but full permission on sub-folders and its content.
Here is the game begun :-

Scenerio :-
User can read/write root folder but can't modify it however he/she has delete rights to perform read/write/modify/delete action on subfolders and files.

Challenge :-
These permissions were easy to provide but if the user perform delete action on root folder then nothing happen with root folder (as user has only read/write permission on it) but subfolders and files immedietly get deleted automatically. try it and you will be stunned !

Fix :-
There is no way to stop this process with NTFS permission but there is always a way to finish .. unfinished job that too with elegant manner. Here is what i did.
i created a file inside this root folder and named it (!donotdelete.txt) and removed all access rights from it.. you see the file name starts with ! and this is wildcard character, so now, whenever any user perform delete action on root folder .. a command execute to delete all subfolders and files but stuck at !donotdelete.txt because this file can't be deleted by anyone and delete command stop here itself.


Catch :- You can create any file/folder with initial letter ! to stop automatic deletion,it will work Guaranteed !.