如果我使用MS Access作为前端,要链接到后端的某些数据库,如何阻止人们浏览相关文件夹并自行复制/删除数据库?
答案 0 :(得分:3)
有几种选择。请参考此链接: http://www.techrepublic.com/blog/10-things/10-tips-for-securing-a-microsoft-access-database/552/
最好的选择是隐藏数据库浏览选项,并使用密码保护数据库。
答案 1 :(得分:1)
您无法保护MS Access中的后端对有权使用它们的用户。你只能隐藏它们。 Windows确实只支持已签名的应用程序的安全授权,但Access从未实现过那些方法。
您可以通过
阻止用户浏览相关文件夹(1)(如在其他答案中所讨论的)隐藏文件夹的名称,以便人们不知道它们在哪里。
(2)隐藏文件夹,除非他们有权查看隐藏文件夹,否则人们无法看到它们。
(3)从顶级文件夹中删除“列出文件夹内容”权限,以便人们无权浏览相关文件夹。
您还可以通过删除文件中的删除权限来阻止人们意外删除数据库。
答案 2 :(得分:0)
这就是我的工作。代码不是我的,我只是根据我做了两个月的研究把它放到了一起。但是,不要产生错误的安全感,因为密码在连接字符串中,所以它们很容易被黑客攻击,你必须找到控制谁从另一个数据库链接到数据库的方法,否则他们仍然可以挖掘数据:
功能HideTheRibbon() DoCmd.ShowToolbar“Ribbon”,acToolbarNo 结束功能
禁止使用KeyPreview选项的F11键
'***************** Code Start ***************
'Assign this to the OnClick event of a command button (or double-click event
'of a label or graphic) named "bDisableBypassKey"
'Change the "TypeYourBypassPasswordHere" default password to your password
Private Sub bDisableBypassKey_Click()
On Error GoTo Err_bDisableBypassKey_Click
'This ensures the user is the programmer needing to disable the Bypass Key
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Key password to enable Bypass Key."
strInput = InputBox(Prompt:=strMsg, title:="Disable Bypass Key Password")
If strInput = "carlo12a" Then
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "Bypass Key has been enabled." & vbCrLf & vbLf & "Shift key will allow users to bypass startup" & _
"options next time database is opened.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & _
"The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_bDisableBypassKey_Click:
Exit Sub
Err_bDisableBypassKey_Click:
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
Resume Exit_bDisableBypassKey_Click
End Sub
'***************** Code End ***************
将此代码放在公共模块下:
'***************** Code Start ***************
'Copy this function into a new public module.
Option Compare Database
Option Explicit
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Error_Handler
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Error_Handler:
If Err.Number = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
'***************** Code End ***************