• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

General File Security question

How can I change the security settings of a file while preserving the
existing inherited access rules and also preventing the access rules from inheriting changes
in the future?
0
YZlat
Asked:
YZlat
  • 4
  • 2
1 Solution
 
Paul JacksonSoftware EngineerCommented:
Right-click the file and select properties.
Select the security tab and click the advanced button.
Uncheck 'Allow inheritable permissions from the parent to propagate to this object and all child objects. Include these entries explicitly defined here' checkbox
On the prompt click copy.
Now add any other permissions you want.
Click ok.
Click ok.
Job done
0
 
YZlatAuthor Commented:
LOL I mean programmatically, using C#. That's why i posted my question in programming zonefor C#
0
 
Paul JacksonSoftware EngineerCommented:
You can do this with the filesecurity class using the addaccessrule method.

http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesecurity.aspx
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
YZlatAuthor Commented:
jacko72, I know I can use this class, but how exactly can I accomplish changing the security settings of a file while preserving the existing inherited access rules and also preventing the access rules from inheriting changes
in the future?
0
 
YZlatAuthor Commented:
Figured out the answer: To set inheritance rules,  FileSecurity.SetAccessRuleProtection method should be used.

And to preservie existing inherited access rules and also prevent the access rules from inheriting changes in the future it should be called with two boolean parameters, true and true:
FileSecurity.SetAccessRuleProtection(true, true)
0
 
YZlatAuthor Commented:
Found the answer I was looking for on my own
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now