My application creates a directory so that I can store log files in it. I am adding user security to the directory, but I do not know how to do this. For example, I add the user everyone to the directory with read and write access, but when my application then creates a log file in this directory, the log file did not inherit the security of everyone (read, write).
What am I missing?
DirectorySecurity dirSec = Directory.GetAccessControl(_dbPath); dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.Write, AccessControlType.Allow)); dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.ReadAndExecute, AccessControlType.Allow)); dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.CreateFiles, AccessControlType.Allow)); Directory.SetAccessControl(_dbPath, dirSec);
security c #
David
source share