Changing NTFS Directory Security in .NET

  • Thread starter Thread starter Duncan Allen
  • Start date Start date
D

Duncan Allen

Hi,

Using VB.NET I need to access a shared drive on a server
using a specific account, check for a subdirectory, add it
if it doesn't exist and then change the access security
for the subdirectory to only allow specific accounts to
access it - these will be different to the account used by
the app.

Thanks for your help.
 
Hello Duncan,

Thanks for your post. I'd like to share the following information with you:

1. You will need to use Access Control functions to add a DACL with an
access-allowed ACE to a folder's security descriptor. I believe the
following MSDN articles are helpful:

File Security and Access Rights
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base
/file_security_and_access_rights.asp

Using Access Control
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/se
curity/using_access_control.asp?frame=true

HOWTO: Use ADSI to Set Automatic Inheritance of File/Folder Permissions
http://support.microsoft.com/?id=266461

2. As you know, the Access Control functions are native APIs. If you want
to call them in you Visual Basic .NET application, you need to use Platform
Invoke as described below:

Consuming Unmanaged DLL Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconconsumingunmanageddllfunctions.asp

BTW, in the future, it would be best to post these questions in the
following newsgroup.
Microsoft.public.platformsdk.security

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
Back
Top