[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

General File Security question

Posted on 2011-03-11
6
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35109312
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
ID: 35111127
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
ID: 35134277
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 35

Author Comment

by:YZlat
ID: 35158642
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
ID: 35164924
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
ID: 35196567
Found the answer I was looking for on my own
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 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