Solved

General File Security question

Posted on 2011-03-11
6
261 Views
Last Modified: 2012-06-21
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
Comment
Question by:YZlat
  • 4
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
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
 
LVL 35

Author Comment

by:YZlat
Comment Utility
LOL I mean programmatically, using C#. That's why i posted my question in programming zonefor C#
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 35

Author Comment

by:YZlat
Comment Utility
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
 
LVL 35

Accepted Solution

by:
YZlat earned 0 total points
Comment Utility
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
 
LVL 35

Author Closing Comment

by:YZlat
Comment Utility
Found the answer I was looking for on my own
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now