Windows Server 2003
1820879 Members
4232 Online
109628 Solutions
New Discussion юеВ

Re: Stop users from deleting files and folders

 
Rooky
Regular Advisor

Stop users from deleting files and folders

Hi everybody,
I have a server with Windows 2003 Server SE which is working as a file server. In this server I have a parent folder with many folders inside with the name of each user, but every time a user try to modify something in his folder something happens because they keep moving their folders inside another or deleting files. Is there a way to prevent the users from doing this with the Windows Server 2003 security?
8 REPLIES 8
Michal Kapalka (mikap)
Honored Contributor

Re: Stop users from deleting files and folders

hi,

yes it is possible, but you need to play with the permitions and user rights.

mikap
Rooky
Regular Advisor

Re: Stop users from deleting files and folders

Hi Michal and thanks for following my case.
Can you please help me on this giving me some tips? I have try everything with no luck.
Edgar Zapata
Esteemed Contributor

Re: Stop users from deleting files and folders

Hi Rooky,
I guess a lot of System admins have already gone through this.
You might want to look at either the xcacls.exe or cacls.exe command.

Be careful what you do here:
I would set NTFS permissions for Everyone:READ and Domain Admins:FULL control at the parent folder through Windows explorer GUI.
Security tab. set the permissions here.
Click on Advanced: click on "Replace permissions entries on all child objects with entries shown here that apply to child objects"
Make sure you also tick on the box that reads "Allow inheritable permissions from the parent to propagate..."

In advance, you should identify which user must have access to which folder under the parent folder in case the child folders have not been named after the %username%.

You might want to do the following:
CMD - change working directory to the parent folder.
dir /ad /b
(watch it here, in case you have weird directory names or over-8-chars- directory names you migfht need to use the /x switch and redirect the output to a file to obtain only the folder names as you can't just use /x along with /ad or /b)
Then you may want to use a FOR loop along with either XCACLS or CACLS like this:

Use this in case the folder names have been named after the usernames:
for /f %a in (folderlist.txt) do xcacls %a /e /g DOMAIN\%a:C

Otherwise, you'll have to figure out a way to set NTFS permissions at each folder.
But I would still suggest using this:

xcacls ChrisGardner_FolderName /e /t /g DOMAIN\ChrisG_AccountName:C
xcacls SteveAtkinson_FolderName /e /t /g DOMAIN\SteveAtkinson_AccountName:C

Hope this will help.

Edgar.
Rooky
Regular Advisor

Re: Stop users from deleting files and folders

Well, I find this pretty risky and all users are going to be angry with me if I disable all permits.
There's no any other way to do what I want?
Edgar Zapata
Esteemed Contributor

Re: Stop users from deleting files and folders

well, then try it this way:

xcacls ChrisGardner_FolderName /e /t /g DOMAIN\ChrisG_AccountName:C

Do one user's folder at a time.
Just make sure you do this:
1. make sure you ADD DOMAIN\administrators group at each folder.
2. You remove any other users at every particular User folder other than the one that needs permissions.

You can do #1 by just doing the FOR loop like this:
for /f %a in (folderlist.txt) do xcacls %a /e /t /e DOMAIN:administrators:F

You are dealing with NTFS permissions and NTFS permissions only.

This is the only way I can think of.
Rooky
Regular Advisor

Re: Stop users from deleting files and folders

Ok, I'm going to try that one Edgar. Thanks for your help. If somenthing comes up, I'll let you know.
Edgar Zapata
Esteemed Contributor

Re: Stop users from deleting files and folders

sorry,
I had a typo above.
It's not /e DOMAIN:administrators but
/g DOMAIN:administrators

/g stands for GRANT
/e stands for EDIT (Edit ACL instead of replacing it).
/t Changes ACLs of specified files in the current directory and all subdirectories.

So, it should be like this:
for /f %a in (folderlist.txt) do xcacls %a /e /t /g DOMAIN:administrators:F
Rooky
Regular Advisor

Re: Stop users from deleting files and folders

Ok, thanks!!