NSIS AccessControl Plugin disable access to directory for all except Admins and System

StackOverflow https://stackoverflow.com/questions/22415426

  •  15-06-2023
  •  | 
  •  

Question

I just read bunch of answers about setting permissions to directory by NSIS AccessControl plugin, but all those only show basic usage copy pasted from plugin site... It only shows cases ALL or NOTHING... but how do I disable ALL permissions to directory for everyone except System and Administrators?

Was it helpful?

Solution

AccessControl::DisableFileInheritance "$temp\test.tmp"
Pop $0
DetailPrint $0

AccessControl::ClearOnFile "$temp\test.tmp" "(S-1-5-18)" "FullAccess"
Pop $0
DetailPrint $0

AccessControl::SetOnFile "$temp\test.tmp" "(S-1-5-32-544)" "FullAccess"
Pop $0
DetailPrint $0

This might not be enough, you should probably also use SetFileOwner and maybe SetFileGroup...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top