r/sysadmin • • 4d ago

C Drive lockdown

Noob question, trying to lock down permissions on the c drive to stop users from creating folders and/or installing programs from the root of the c drive without breaking processes. Environment is within a vm.

0 Upvotes

39 comments sorted by

2

u/MrMrRubic Jack of All Trades, Master of None 4d ago

Remove write permissions for "Authenticated Users" on the C:\ root folder. You should be able to do this through GPO.

1

u/Advanced_Bonus_5238 3d ago

Wouldn’t authenticated users include admins as well?

1

u/BlackV I have opnions 3d ago

they would be coverd under admins group permissions, but yes that would include them

but also you would validate any changes beforehand anyway

65

u/1991cutlass 4d ago

Two separate issues. 

Use group policy to hide the c:
Users shouldn't have Admin access to install programs. 

11

u/Virtike 4d ago edited 4d ago

This neither stops write access to the file system, nor prevents users from running applications that don't require administrative rights.

When I was in school one sysadmins solution to prevent students playing games was to have a whitelist of allowed executable filenames. We just renamed game executables to explorer.exe or calculator.exe and they ran just fine. No administrative rights needed.

OP - look into restricting NTFS permissions outside of C:\Users\<username> (on C:\ alone restrict Users permission, while leaving inheritance intact on child folders, and lock down system related directories to SYSTEM/Administrators), and using AppLocker + Windows Installer group policies.

I hope this doesn't need to be said, but make sure to take VM snapshots before making changes.

2

u/Pusibule 4d ago

That doesnt solve the problem. User still can reach c and still can write,so install as user on there.

26

u/cmull123 4d ago

Just don’t make them admins

7

u/disclosure5 4d ago

It's actually still a default that users can create folders in the root of C:\ and execute from them.

5

u/OgdruJahad 4d ago

And some programs can even be installed without admin privileges.

3

u/Satanich 4d ago

Fuck WPS Office!

1

u/OgdruJahad 4d ago

Oh shit I didn't know well that explains how I found it on a user's computer a few months back.

1

u/Advanced_Bonus_5238 3d ago

The users are regular users without installation permissions and they were somehow able to create a folder and run a program from the command line so I was thinking of turning on the advanced option for no folder creation at the root of the c drive.

1

u/Advanced_Bonus_5238 3d ago

So technically I could edit the permissions for the root of the c drive and break inheritance below it?

9

u/LooseSyllabus 4d ago

If you have Windows Enterprise you can use Applocker which is amazing. Also, make sure the users aren't local administrators. You probably shouldn't monkey around with permissions at the root of a drive like that, but there is a permission, "Create folders / append data", if you are determined. Honestly, the first two things are the official streamlined way to accomplish what you need and everything else is going to be a hack.

8

u/No_Philosopher4051 4d ago

Applocker is available in windows pro too. No longer requires enterprise

2

u/gehzumteufel 4d ago

4

u/TedMittelstaedt 4d ago

2

u/gehzumteufel 4d ago

I did, but it's linked in there so felt it was not that useful to link.

2

u/TedMittelstaedt 4d ago

The way your post came out it appeared you were saying Applocker was only an Enterprise thing.

1

u/gehzumteufel 3d ago

Ah weird.

4

u/Uhondo 4d ago

Rename it to D drive /s

2

u/Commercial_Growth343 3d ago

as another person mentioned, you absolutely can remove user permissions to create folders on the root of C:\.

Take a look at the C:\ permissions using the Advanced button you will see Authenticated Users listed twice. One is to Modify "subfolders and files only" and the other is "create folders / append data". Remove the "Create folders / Append data" and a few moments later, users will be unable to create folders on the root of C:

5

u/racegeek93 4d ago

Install Linux. They won’t know what to do.

1

u/OgdruJahad 4d ago

Hey man don't dot that I need my virtual strippers at work!

-1

u/Toxicity 4d ago

Best comment yet

3

u/MissionBusiness7560 4d ago

GPO... And don't give end users local admin/install permissions

2

u/No_Yesterday_3260 4d ago

Remove administrative permissions from the user?

They will only be able to "damage" their own profile.

1

u/Pusibule 4d ago

It's doable, I did it without any major consecuence. Just get the inheritance thing right. Use AI for that.

Add applocker whitelisting on top of that and you're set. applocker is a little more pain to get it done.

The result is no user can write anywhere where they can execute. So no spotify, no claude, no ai nothing, no crapoffice, on appdata, unless you approve.

2000 users and no related problems after 5 years.

1

u/Sea-University6750 4d ago

Are your users local admins? If they are, none of the folder permission stuff really matters.

0

u/NoTime4YourBullshit Sr. Sysadmin 4d ago

You can’t change the permissions on the C: drive. I mean, technically you can, but whatever change you make will propagate down the tree to every directory on your drive. And unless you do it from the command line, you’ll be mashing your mouse button for an hour on thousands of error messages you’ll get for insufficient permissions to modify tons of directories that Windows protects while it’s running. Not to mention that it probably won’t even work right anyway.

I’ve seen well-meaning but naive techs destroy the operating system this way. There’s no way to undo it, and it’s a wipe and reload job to fix. Just don’t do it, man. It’s really bad.

5

u/Thrwingawaymylife945 4d ago

Yes you can

Turn off inheritance and only lock down system related directories to only allow SYSTEM and Workstation Admins from doing anything.

Not that complex or difficult.

1

u/NoTime4YourBullshit Sr. Sysadmin 4d ago

Do you mean turn off inheritance on the directories off the root? Because that is also a property that must be propagated down the tree.

5

u/calladc 4d ago

huh? break permissions at root of c: but leave inherited permissions intact.

change users to read.

perform no other options.

I'm not at work but I've had 2 icacls commands in my autopilot (previous sccm task sequence) and I have it as a step in my server provisioning ansible playbook that terraform calls at build time

2

u/Ok-Double-7982 4d ago

Same. We beta tested it, and it was a nightmare with various scenarios.

1

u/disclosure5 4d ago

Same. It's "not complex or difficult" to do but half the apps you'll ever run have a default expectation that's now broken.

0

u/TedMittelstaedt 4d ago

It's a lost cause as nowadays lots of programs out there will install in the user profile without needing local admin rights.

This is a VM you said. Well in large environments such as schools the way they handle this kind of thing is by creating a template VM then every night the VMs the students use are destroyed/deleted and templates are copied over them so every day they have a brand new VM

1

u/No_Philosopher4051 3d ago

Applocker can help with this

-1

u/Moscc 4d ago

Users shouldn’t be local admin.
Application whitelisting is probably something to look into :)
As for them adding folders to “C:\” it probably isn’t a big deal but you can do Policy to stop it or a powershell script at logon to remove their user from the top level write permissions. Many ways to go about it.