The Computer Oracle

How to prevent users from deleting a folder, while still giving them modify permissions to its contents?

--------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2

--

Chapters
00:00 Question
00:51 Accepted answer (Score 16)
03:03 Answer 2 (Score 1)
03:35 Answer 3 (Score 1)
04:14 Answer 4 (Score 0)
07:12 Thank you

--

Full question
https://superuser.com/questions/720486/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ntfs #filepermissions

#avk47



ACCEPTED ANSWER

Score 16


As Graham pointed out, using multiple permissions entries for the same user (something I had never tried before) was the key here:

enter image description here

The permissions on the parent folder give the users almost absolute freedom to make any change... except that the "delete" box is unchecked - so users cannot delete/move/rename this important folder by accident:

enter image description here

Moving on to the second permission set for the same user (which apply not to the folder itself, but to its contents), we see the exact same rights granted to the user, including "delete" privileges.

So, users can do anything they wish to the subfolders and files, including deleting/moving/renaming them.

enter image description here

This configuration allows me to protect key folders, such as personalised target scan directories which reside in user personal network locations. Users can modify the contents (such as deleting PDFs of scans they no longer wish to keep), but cannot inadvertently cause problems for themselves by deleting a folder the scanner expects to see when saving to the network.

I had to disable inheritance for the special folder as it was otherwise not possible to make changes to the user's permissions which varied from the root of the network share; however, all subfolders and objects do use inheritance in order to obtain their permissions from their parent folder.

Once I figured out exactly what needed to be done, this only took a couple of minutes to adjust for each user. I now have peace of mind that key network folders cannot accidentally get deleted by users.




ANSWER 2

Score 1


The folder should have read permission, delete subfolders and files, create folders /append data, create files / write data, read attributes, list folder / read data, traverse folder / execute file and that's it. The contents should be full control. This combination should (assuming correct ownership of the files and correct user creation and administration) allow your users to have access through the folder to it's contents, without them being able to delete or modify the folder itself.




ANSWER 3

Score 1


The ability to delete something from a folder is usually dependent upon the permissions assigned by the parent and not the folder itself (i.e. You can't say: "Don't delete me"). So this means you need to control the delete permission of the folder itself in the permissions of the parent of the folder.

For example:

A
|-B
| + a.html
| + b.html
| + c.html
+-C
  + a.doc
  + b.doc
The ability to delete "a.html" is controlled by "B" (or inherited from "A"). So if you want to stop being able to delete "B" then you need to set the permissions properly on "A". This gets rather annoying when you want to be able to delete "C" but not "B". Sometimes assigning the ownership of a folder (but not its contents) to a separate user is easier and more obvious.




ANSWER 4

Score 0


If Austin Power's answer is not working for you here's two other options

Option 1

Just create a sub-folder with one empty text file and take away access for them from the users you wish to protect.

How does it work?: Since the users can't delete the file in the sub-folder they also can't delete the sub-folder and the parent folder.

Caution!: If you try to delete the parent folder you will indeed fail but only after everything inside has been deleted (except of course the special folder/file).

Option 2

Follow this procedure Prevent Folder Deletion or inadvertent Drag and Drop with NTFS security