Folder Protection for Personal Data Storage at Windows 7 Operating System
-
22 Juli 2012 9:28
Hi All,
Sorry, my english not good. I wish my question quiet enough to be understood.
The security access control code below can not work perfectly at Windows 7, because user accunt with administrator previlage still can change security permision for c:\documents and settings\owner\downloads at advanced security tab.
I wish there is someone who don't mind to corect or resolve my problem, thank's.
Imports System.Security.AccessControl
Imports System.IO
Public Class Form1
' Remove access from folder
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FilePath As String = "C:\Documents and Settings\Owner\Desktop\downloads"
Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
fs.AddAccessRule(New FileSystemAccessRule(My.user.name, FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(FilePath, fs)
End Sub
' Add access to folder
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim FilePath As String = "C:\Documents and Settings\Owner\Desktop\downloads"
Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
fs.RemoveAccessRule(New FileSystemAccessRule(My.user.name FileSystemRights.FullControl, AccessControlType.Deny))
File.SetAccessControl(FilePath, fs)
End Sub
End ClassThe code above can not work perfectly at Windows 7, because the security settings for download folder at owner administrator name account list, can be removed or midified by all administrator user account.
- Diedit oleh Pranoto Hadi Wijoyo 22 Juli 2012 9:35
Semua Balasan
-
23 Juli 2012 8:38
Hello,
As you see, Administrator account has permission to every file\folder. Maybe you can use this to lock file:http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/f833bdc7-347a-483c-9f2a-aeb44142b000/
-
03 Agustus 2012 6:41IMO, download folder was not network shared by default, so you can remove permissions to not standard uses. Moreover, you can set sharing this folder like this:http://windows.microsoft.com/en-GB/windows7/File-sharing-essentials
Think again!