开发者

Do Access Control rights remain after application closes?

开发者 https://www.devze.com 2023-03-19 20:18 出处:网络
This may be a stupid question, but I\'m struggling to find an answer to this on google or on here. If I use .NET\'s Directory.SetAccessControl() function in my application to set or alter ce开发者_St

This may be a stupid question, but I'm struggling to find an answer to this on google or on here.

If I use .NET's Directory.SetAccessControl() function in my application to set or alter ce开发者_StackOverflowrtain access rights for certain users, do these access rights then remain altered when the function in which I do this goes out of scope or my application is closed?

I'm still gaining experience in lots of areas in C# and .NET programming, so again pardon if this is a silly question. It just seems that this may leave huge security holes or risks if one is able to just alter access permissions willy-nilly from code, so my feeling is that this can't be permanent.

Any hints in the right direction would be appreciated.


The changes made by this (and associated calls) are permanent - so be careful.

You have to remember though that your application will need to be running under an account that has the necessary permissions to make these changes though. So ordinary users, for example, won't be able break anything - unless you make efforts to have your program impersonate another user.


Yes, rights remain because they are applied to file system and stored on disk


Yes, if you change the access right you will change the ACL, these are for the whole system:

Applies access control list (ACL) entries described by a DirectorySecurity object to the specified directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消